Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions kubectl-kuttle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it also makes sense to convert the script to a plain posix shell. e.g. #!/bin/sh and add an -e flag to stop in case of errors: https://www.grymoire.com/Unix/Sh.html#uh-55


# start the sshuttle tunnel
if [[ $1 == "start" ]]; then
mkdir -p ~/.cache
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your contribution. can you add tabs or spaces to make the code more human readable?

kubectl run kuttle --image=alpine:latest --restart=Never -- sh -c 'apk add python3 --update && exec tail -f /dev/null'
sshuttle --remote kuttle --dns --daemon --pidfile ~/.cache/kuttle.pid --auto-hosts --ssh-cmd kuttle 0.0.0.0/0
exit 0
fi

# stop the sshuttle tunnel
if [[ $1 == "stop" ]]; then
kill `cat ~/.cache/kuttle.pid`;
kubectl delete pod/kuttle --force
exit 0
fi

# help docs
echo "kubectl kuttle [start/stop]"
exit 1