Is There a Way to Detect Changes made to Resources Deployed by a Helm Chart

Viewed 972

We have several resources deployed as part of a helm (v3) chart. Some time ago, I made changes to resources deployed by that helm chart manually, via kubectl. This caused some drift between the values in the yaml resources deployed by the helm release (as show by helm get values <release>) and what is actually deployed in the cluster

Example: kubectl describe deployment <deployment> shows an updated image that was manually applied via a kubectl re-apply. Whereas helm show values <release> shows the original image used by helm for said deployment.

I realize that I should have performed a helm upgrade with a modified values.yaml file to execute the image change, but I am wondering if there is a way for me to sync the state of the values I manually updated with the values in the helm release. The goal is to create a new default values.yaml that reflect the current state of the cluster resources.

Thanks!

1 Answers

This is a community wiki answer posted for better visibility. Feel free to expand it.

According to the Helm issue 2730 this feature will not be added in the Helm, as it is outside of the scope of the project.

It looks like there is no existing tool right from the Helm, that would help to port/adapt the life kubernetes resource back into existing or new helm charts/releases.

Based on this, you can use one of the following options:

  1. As suggested by @David Maze. The Helm Diff Plugin will show you the difference between the chart output and the cluster, but then you need to manually update values.yaml and templates.
  2. The helm-adopt plugin is a helm plugin to adopt existing k8s resources into a new generated helm chart.
Related