Skip to content

Instantly share code, notes, and snippets.

@skuethe
skuethe / .bash_aliases
Created November 6, 2020 12:19
bash alias for easily decrypting helm3 release secrets
helmsecret() {
local fetchSecretJson
local doesSecretExist
if [[ -z "${1}" ]]; then
echo "Missing secret name. Terminating"
exit 1
else
if [[ "${1}" == *"sh.helm.release"* ]]; then
fetchSecretJson=$(kubectl get secret --ignore-not-found --all-namespaces --output json --field-selector "metadata.name=${1}")
doesSecretExist=$(echo "${fetchSecretJson}" | jq --raw-output 'if (.items | length) > 0 then "true" else empty end')