Skip to content

Instantly share code, notes, and snippets.

@cornfeedhobo
Last active November 5, 2023 14:13
Show Gist options
  • Save cornfeedhobo/a66141dc5e99cee579aeabcfb72b03df to your computer and use it in GitHub Desktop.
Save cornfeedhobo/a66141dc5e99cee579aeabcfb72b03df to your computer and use it in GitHub Desktop.
Retrieve helm deployment json from a provided secret name
#!/usr/bin/env bash
if [ $# -ne 1 ]; then
cat >&2 <<-USAGE
Usage: $0 <namespace>/<secret>
Example: $0 cert-manager/sh.helm.release.v1.cert-manager.v1
USAGE
exit 1
fi
namespace="$(cut -d'/' -f1 <<<"${1}")"
name="$(cut -d'/' -f2 <<<"${1}")"
exec kubectl get secret \
-n "$namespace" "$name" \
-o jsonpath='{ .data.release }' |
base64 -d |
base64 -d |
gunzip -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment