Skip to content

Commit

Permalink
Save! Automatic commit from github.com/kris-nova/bin/git-save
Browse files Browse the repository at this point in the history
Signed-off-by: Kris Nóva <[email protected]>
  • Loading branch information
krisnova committed May 20, 2022
1 parent e14a393 commit 661fa85
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ test: clean compile install ## 🤓 Run go tests
@echo "Testing..."
go test -v ./...

container: clean ## Build the kush container
container: ## Build the kush container
docker build --cpuset-cpus=$(cpuset) -t $(image_repo)/$(image_name):$(image_tag) .
#docker build --cpuset-cpus=$(cpuset) -t $(image_repo)/$(image_name):$(sha) .

push: ## Push the kush container
docker push $(image_repo)/$(image_name):$(image_tag)
#docker push $(image_repo)/$(image_name):$(sha)

container-base: clean ## Build the base container
container-base: ## Build the base container
docker build --cpuset-cpus=$(cpuset) -t $(image_repo)/$(image_name)base:$(image_tag) image/
#docker build --cpuset-cpus=$(cpuset) -t $(image_repo)/$(image_name)base:$(sha) .

Expand All @@ -73,7 +73,7 @@ exec: ## Run an exec into a kush container
clean: ## Clean your artifacts 🧼
@echo "Cleaning..."
rm -rvf release/*
rm -rvf kush
rm -rvf kobfuscate

.PHONY: release
release: ## Make the binaries for a GitHub release 📦
Expand Down
73 changes: 73 additions & 0 deletions kush
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash
# =========================================================================== #
# MIT License Copyright (c) 2022 Kris Nóva <[email protected]> #
# #
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ #
# ┃ ███╗ ██╗ ██████╗ ██╗ ██╗ █████╗ ┃ #
# ┃ ████╗ ██║██╔═████╗██║ ██║██╔══██╗ ┃ #
# ┃ ██╔██╗ ██║██║██╔██║██║ ██║███████║ ┃ #
# ┃ ██║╚██╗██║████╔╝██║╚██╗ ██╔╝██╔══██║ ┃ #
# ┃ ██║ ╚████║╚██████╔╝ ╚████╔╝ ██║ ██║ ┃ #
# ┃ ╚═╝ ╚═══╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ┃ #
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ #
# #
# This machine kills fascists. #
# #
# =========================================================================== #

NS="n0va"
IMG="krisnova/kush"
CMD="[ \"/bin/bash\" ]"
overrides="$(
cat <<EOT
{
"spec": {
"hostPID": true,
"hostNetwork": false,
"containers": [
{
"securityContext": {
"privileged": true
},
"image": "$IMG",
"name": "nova",
"stdin": true,
"stdinOnce": true,
"tty": true,
"env": [
{
"name": "PODNAME",
"valueFrom": {
"fieldRef": {
"fieldPath": "metadata.name"
}
}
}
],
"command": $CMD
}
],
"tolerations": [
{
"key": "CriticalAddonsOnly",
"operator": "Exists"
},
{
"effect": "NoExecute",
"operator": "Exists"
}
]
}
}
EOT
)"
echo $overrides | jq
pod="n0va-$(env LC_ALL=C tr -dc a-z0-9 </dev/urandom | head -c 6)"
generator=""
m=$(kubectl version --client -o yaml | awk -F'[ :"]+' '$2 == "minor" {print $3+0}')
if [ "$m" -lt 18 ]; then
generator="--generator=run-pod/v1"
fi
kubectl create ns $NS
kubectl run -n $NS --image "$IMG" --restart=Never --overrides="$overrides" -ti "$pod" $generator
kubectl delete po $pod -n $NS

0 comments on commit 661fa85

Please sign in to comment.