flux2 icon indicating copy to clipboard operation
flux2 copied to clipboard

Need the ability to disable HelmRelease upgrades when a configmap value is changed

Open mvaal opened this issue 2 years ago • 4 comments

Describe the bug

We are using HelmRelease with a valuesFrom field using a ConfigMap. We have a need where we do not want to trigger a HelmRelease on ConfigMap change, but only HelmRelease itself is updated.

Steps to reproduce

  1. Create a HelmChart with a strict JSON schema.
  2. Update the chart so it adds a new value to the schema.
  3. Push the updated value to the ConfigMap
  4. Upgrade the HelmRelease Chart version

The ConfigMap upgrade will trigger a HelmRelease before the Chart is updated, but the strict json schema to fail the release, then the HelmRelease will trigger an upgrade and it will succeed.

We have a need to only trigger it once without failure.

Expected behavior

The ConfigMap upgrade should not trigger a HelmRelease, then the HelmRelease will trigger an upgrade and it will succeed.

Screenshots and recordings

No response

OS / Distro

N/A

Flux version

N/A

Flux check

N/A

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

mvaal avatar Jan 12 '22 22:01 mvaal

Are you using a GitRepository source for your helm release?

This has some quirks, if that's the case then you should try setting the reconcileStrategy in spec.chart.spec to Revision, as HelmChart resources are considered to be immutable by version, the Helm Controller will not reconcile a new HelmChart until it sees the chart version has been updated:

https://fluxcd.io/docs/components/helm/api/#helm.toolkit.fluxcd.io/v2beta1.HelmChartTemplate

Edit: Sorry, I think I may have misinterpreted your question...

kingdonb avatar Jan 26 '22 13:01 kingdonb

No problem. Also we are unfortunately not using GitRepository either.

mvaal avatar Jan 27 '22 01:01 mvaal

https://fluxcd.io/docs/guides/helmreleases/#refer-to-values-in-configmaps-generated-with-kustomize (maybe related)

Is this the relationship between your configmap and helmrelease, or something else?

If the configmap is a source in valuesFrom then a change to the configmap represents a change to the inputs, which will trigger HelmRelease to upgrade on the next reconcile.

There are three things AIUI which Helm Controller checks for updates on each reconcile, that finding any in an altered state will result in an upgrade operation: valuesFrom inputs, the HelmRelease in the spec itself, and the Helm Chart (which effectively only changes when the HelmRepository publishes a new revision.)

It's not clear enough what you're trying to accomplish without examples from your own manifests. Without more information we are not likely to be able to help you resolve this. Could you post the helmrelease and configmap?

(I'm interested in what you are doing with JSON Schema, I've never seen it used together with Helm although I know it's supported!)

kingdonb avatar Jan 27 '22 12:01 kingdonb

I will mock up an example for you tomorrow, sorry I can't get to it this weekend. The JSON schema is just the easiest way to break it, you don't need it to achieve the issue (happy to do it that way though if you are looking for an example). Will get back to you.

Helm Controller checks for updates on each reconcile, that finding any in an altered state will result in an upgrade operation: valuesFrom inputs

Exactly, my ask is for the ability to disable this specific case. We would like to update from the HelmRelease spec only (an annotation flag to disable seems appropriate).

mvaal avatar Jan 30 '22 16:01 mvaal