diff options
author | Patrick Spek <p.spek@tyil.nl> | 2022-05-06 14:05:55 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2022-05-06 14:05:55 +0200 |
commit | 67bd6c4c10a2ebc3ec5d4ab7f9f1b567670c1c63 (patch) | |
tree | 7e6dc4df55c8b1a129ddd2bbf05ae3e55f4e708f /.local | |
parent | b243bd381cf94588753baf77f5e0085a6db1f12c (diff) |
Update kubectl-shell
Diffstat (limited to '.local')
-rwxr-xr-x | .local/bin/kubectl-shell | 9 |
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 \ |