| 123456789101112131415161718192021222324252627 |
- #!/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)
- # wayland
- # printf "$password" | wl-copy
- # x11:
- printf "$password" | xclip -selection clipboard
- # reset context
- kubectl config use-context $current_context >/dev/null
- kubectl config set-context --current --namespace=oc-app >/dev/null
|