aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/kubectl-shell9
1 files changed, 7 insertions, 2 deletions
diff --git a/.local/bin/kubectl-shell b/.local/bin/kubectl-shell
index 2e1c2c8..781edfa 100755
--- a/.local/bin/kubectl-shell
+++ b/.local/bin/kubectl-shell
@@ -13,10 +13,12 @@
main()
{
# Handle opts
- while getopts ":h" opt
+ while getopts ":hi:t:" opt
do
case "$opt" in
h) usage && exit 0 ;;
+ i) DOCKER_IMAGE="$OPTARG" ;;
+ t) DOCKER_TAG="$OPTARG" ;;
*)
printf "Invalid option passed: %s\n" "$OPTARG" >&2
;;
@@ -25,8 +27,11 @@ main()
shift $(( OPTIND - 1 ))
+ [ -z "$DOCKER_IMAGE" ] && DOCKER_IMAGE="alpine"
+ [ -z "$DOCKER_TAG" ] && DOCKER_TAG="latest"
+
kubectl run "shell-$(uuidgen)" \
- --image alpine:latest \
+ --image "$DOCKER_IMAGE:$DOCKER_TAG" \
--restart=Never \
--rm \
--stdin \