Created
July 25, 2023 07:10
-
-
Save BobyMCbobs/329d57264f0ef1d217e4b2382e9bf364 to your computer and use it in GitHub Desktop.
A small bash script to tidly base64 decode secrets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
POSITIONAL_ARGS=() | |
NAMESPACE=default | |
while [[ $# -gt 0 ]]; do | |
case $1 in | |
-n|--namespace) | |
NAMESPACE="$2" | |
shift # past argument | |
shift # past value | |
;; | |
*) | |
POSITIONAL_ARGS+=("$1") # save positional arg | |
shift # past argument | |
;; | |
esac | |
done | |
set -- "${POSITIONAL_ARGS[@]}" | |
SECRET="$1" | |
kubectl -n "${NAMESPACE:-default}" get secrets "$SECRET" -o=go-template='{{ range $key, $value := .data }}{{ $key }}={{ base64decode $value }}{{ "\n" }}{{ end }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment