25 lines
634 B
Bash
Executable file
25 lines
634 B
Bash
Executable file
#!/bin/sh
|
|
|
|
PREFIX="oc-"
|
|
SUFFIX="-eks-cluster"
|
|
FINAL=""
|
|
|
|
if [ -z "$1" ]; then
|
|
exit 1
|
|
fi
|
|
|
|
context="$PREFIX$1$SUFFIX"
|
|
current_context=$(kubectl config current-context)
|
|
|
|
kubectl config use-context $context >/dev/null
|
|
kubectl config set-context --current --namespace=oc-app >/dev/null
|
|
|
|
# is second argument provided then silent exit
|
|
password=$(kubectl get secret oc-secrets -o jsonpath="{.data.rabbit_passwd}" | base64 --decode)
|
|
|
|
printf "$password" | wl-copy
|
|
# printf "$password" | xsel --clipboard
|
|
|
|
# reset context
|
|
kubectl config use-context $current_context >/dev/null
|
|
kubectl config set-context --current --namespace=oc-app >/dev/null
|