fix: Set the current ns if one is not set

This commit is contained in:
Nikolai Rodionov 2023-06-20 00:22:05 +02:00
parent dac88324a5
commit 011ee485aa
Signed by: allanger
GPG Key ID: 19DB54039EBF8F10
2 changed files with 3 additions and 1 deletions

View File

@ -27,3 +27,4 @@ Examples:
```
$ kubers -n $SECRET_NAME
```

View File

@ -20,6 +20,7 @@ funcion _kubers() {
_values compadd $(kubectl get namespaces --no-headers -o custom-columns=":metadata.name")
;;
secret)
NAMESPACE=$(kubectl config view --minify -o jsonpath='{..namespace}')
for (( i = 1; i <= $#words - 1; i++ )); do
if [[ $words[$i] == -n || $words[$i] == --namespace ]]; then
NAMESPACE=$words[$((i+1))]
@ -40,4 +41,4 @@ funcion _kubers() {
_values compadd $(for KEY in $(kubectl --namespace $NAMESPACE get secret $SECRET_NAME -o yaml | yq '.data | keys' | sed -e "s/- //"); do echo $KEY; done)
;;
esac
}
}