Recovering a lost helm values file

Issue

You forgot to backup your helm values file used when you originally installed CloudBees CI or CloudBees CD via helm, and you’re not sure what values to use when upgrading to a newer release.

Environment

Resolution

The helm values file used during the initial install is still available as long as the product is still installed, even if you don’t have it in source control somewhere. The first step is to run:

helm list --all-namespaces

You should see some output such as:

NAME                                    NAMESPACE               REVISION        UPDATED                                         STATUS          CHART                                   APP VERSION            
cloudbees-core                          cloudbees-core     46              2021-04-19 15:35:57.493384046 +1000 +1000       deployed        cloudbees-sda-1.270+625596de7f32        10.1.0.145850+2.277.2.

Now we need to use the release name (NAME) and the namespace (NAMESPACE) from that output to get the values, using the helm get values command:

helm get values $RELEASE_NAME -n $NAMESPACE > values-prod.yaml
## for example:
helm get values cloudbees-core -n cloudbees-core > values-prod.yaml

We should then check in that values-prod.yaml to source control, and we can use that as a basis for the values when running an upgrade, or installing a ‘dev’ environment based on the current production values files (after modifying values such as the hostname).

Note: you can also get the values used for a specific revision (not just the latest) with helm history $RELEASE_NAME -n $NAMESPACE. That gives you the list of revisions and then you can run helm get values cloudbees-core -n cloudbees-core --revision <revisionNumber>. Helm keeps only 10 revisions in its history by default, unless you use the option --history-max when you upgrade.

Tested product/plugin versions

CloudBees CI helm chart version cloudbees-sda-1.270+625596de7f32

References

https://helm.sh/docs/helm/helm_get_values/#helm-get-values

Have more questions?

0 Comments

Please sign in to leave a comment.