Skip to content

Instantly share code, notes, and snippets.

@duboisf
Last active November 7, 2025 19:07
Show Gist options
  • Select an option

  • Save duboisf/03a7ce746d59f7a729498f7eb2d9a657 to your computer and use it in GitHub Desktop.

Select an option

Save duboisf/03a7ce746d59f7a729498f7eb2d9a657 to your computer and use it in GitHub Desktop.
Modifying a helm release to remove invalid/non-existing apiVersions

Get the secret and extract the release.json from it

kubectl get secret sh.helm.release.v1.<helm release>.<release version> -o json > helm-release-secret.json
# backup just in case
cp helm-release-secret.json helm-release-secret.json.bak
# extract the actual release from the secret
jq -r '.data.release' helm-release-secret.json \
  | base64 -d \
  | base64 -d \
  | gunzip \
  | jq \
  > release.json

Modify the manifest field and re-encode it in the release json

jq -r .manifest release.json > manifest.yaml
# modify manifest.yaml as you wish
jq --arg manifest "$(cat manifest.yaml)" '.manifest = $manifest' release.json > release-mod.json

Re-encode the modified release json into the secret

Notice the jq -c . release-mod.json, it's to compact the json, removes newlines (there are a lot of lines in the json like ~2K).

jq --arg release "$(jq -c . release-mod.json | gzip | base64 -w0 | base64 -w0)" '.data.release = $release' helm-release-secret.json > helm-release-secret-mod.json

Update the helm release secret in the kube cluster

kubectl apply -f helm-release-secret-mod.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment