home: install kubernetes tools

This commit is contained in:
Leonardo Eugênio 2026-03-03 23:16:30 -03:00
parent 9f001b8c17
commit 7f899de0d3
3 changed files with 39 additions and 0 deletions

30
scripts/kubectl-rsh Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -exu
set -o pipefail
namespace=''
container=''
pod=$1
shift
# rsync calls us with "-l pod namespace" if we use pod@namespace
if [ "X$pod" = "X-l" ]; then
pod=$1
shift
namespace="-n $1"
shift
fi
# pod is "pod.container"
if [[ "$pod" == *"."* ]]; then
container="-c ${pod#*.}"
pod="${pod%.*}"
fi
# pod is "type#name"
if [[ "$pod" == *"#"* ]]; then
pod="${pod//#/\/}"
fi
exec kubectl $namespace exec -i $container $pod -- "$@"