rmq-passwd 661 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. PREFIX="oc-"
  3. SUFFIX="-eks-cluster"
  4. FINAL=""
  5. if [ -z "$1" ]; then
  6. exit 1
  7. fi
  8. context="$PREFIX$1$SUFFIX"
  9. current_context=$(kubectl config current-context)
  10. kubectl config use-context $context >/dev/null
  11. kubectl config set-context --current --namespace=oc-app >/dev/null
  12. # is second argument provided then silent exit
  13. password=$(kubectl get secret oc-secrets -o jsonpath="{.data.rabbit_passwd}" | base64 --decode)
  14. # wayland
  15. # printf "$password" | wl-copy
  16. # x11:
  17. printf "$password" | xclip -selection clipboard
  18. # reset context
  19. kubectl config use-context $current_context >/dev/null
  20. kubectl config set-context --current --namespace=oc-app >/dev/null