home: install kubernetes tools
This commit is contained in:
parent
9f001b8c17
commit
7f899de0d3
3 changed files with 39 additions and 0 deletions
|
|
@ -48,6 +48,11 @@
|
|||
_diffr
|
||||
];
|
||||
kak-man-pager = [ kak-pager ];
|
||||
kubectl-rsh = [
|
||||
bash
|
||||
kubectl
|
||||
rsync
|
||||
];
|
||||
helix-pager = [
|
||||
fish
|
||||
_diffr
|
||||
|
|
|
|||
30
scripts/kubectl-rsh
Executable file
30
scripts/kubectl-rsh
Executable 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 -- "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue