helm-controller icon indicating copy to clipboard operation
helm-controller copied to clipboard

HelmChartConfig deletion is not tracked

Open tallaxes opened this issue 4 years ago • 7 comments
trafficstars

It appears the controller is currently silently ignoring the deletion of HelmChartConfig resource. It seems the the controller should track those, and redeploy (upgrade?) the corresponding Helm release to reflect the new desired state. Since the controller does track updates, a workaround is to update the deployed HelmChartConfig resource to one with "empty" values. But properly tracking deletions would be better, as it would match the intuitive expectations / principle of least surprise.

tallaxes avatar Sep 16 '21 23:09 tallaxes

Isn't this a duplicate of https://github.com/k3s-io/helm-controller/issues/33 ?

SchoolGuy avatar Nov 01 '21 18:11 SchoolGuy

@SchoolGuy: No, it is not. #33 is not very precise about exactly what deletion is failing, but it is most likely about deletion of Helm releases via deletion of HelmChart resource. This one is about removing the customization / extra values via deletion of HelmChartConfig resource - and keeping / redeploying the release.

tallaxes avatar Nov 01 '21 18:11 tallaxes

I am using k3s-v1.21.4+k3s1. Also running into this issue. Adding a HelmChartConfig results in my k8s resources getting updated, but nothing happens when deleting it.

Taking traefik as an example. The following things would happen when I add a HelmChartConfig

  • A Configmap in which all the Helm Values are stored is updated. The new values is appended into the Configmap. (It is chart-values-traefik in my example)
  • The helm-install Job (which is helm-install-traefik in my example) is re-created. The helm-install is re-run against the updated Configmap.
  • My k8s resources are updated expectedly.

When deleting the HelmChartConfig, nothing happens

  • The Configmap is not updated
  • The Job is not re-created
  • Nothing gets updated

ckyoog avatar Jan 31 '22 19:01 ckyoog

I can confirm this report. Just ran into this because I changed the traefik log level to debug. After fixing my problem I removed the HelmChartConfig again.

My expectation was the traefik would be upgraded with the old log level. Instead it kept running at log level debug.

tlandschoff-scale avatar Aug 23 '22 10:08 tlandschoff-scale

Hello, I had the problem today, and maybe I can add more info: I wanted to move the content of the HelmChartConfig CRD to the "valuesContent" field of the HelmChart CRD, while doing some modification to the config. So I deleted the HelmChartConfig CRD and updated the HelmChart CRD with a "valuesContent" field.

When I applied my modifications, the helm job did run, but the old values of the deleted HelmChartConfig were still used instead of the new ones from the HelmChart.

The problem comes from the "chart-values-xxx" secret which still contains the "values-10_HelmChartConfig.yaml" data, which contains the values from the deleted HelmChartConfig. These values take precedence over the "values-01_HelmChart.yaml" that exists in the same secret.

To workround the problem, I deleted the secret before removing the HelmChartConfig CRD

guillaumebernard84 avatar May 23 '24 14:05 guillaumebernard84

The ValuesSecret contents are regenerated every time the HelmChart or HelmChartConfig resource are modified: https://github.com/k3s-io/helm-controller/blob/2f32059d43e626be840b7021c2c8028790f53c1f/pkg/controllers/chart/chart.go#L590-L618

If the HelmChartConfig is deleted, the relevant section will be absent from the generated secret. I don't see any way that the values-10_HelmChartConfig.yaml would continue to be present if the source for that content is gone.

brandond avatar May 23 '24 19:05 brandond