Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm: Flux doesn't change drifted resources #3468

Closed
1 task done
Andrea-Gallicchio opened this issue Jan 8, 2023 · 4 comments
Closed
1 task done

Helm: Flux doesn't change drifted resources #3468

Andrea-Gallicchio opened this issue Jan 8, 2023 · 4 comments

Comments

@Andrea-Gallicchio
Copy link

Describe the bug

After having released a Helm Release that installs for example a deployment, If I manually edit the deployment itself, Flux doesn't change the resource to the state of the Git repository, even if I run flux reconcile hr .....

This is really weird because I'm sure it worked fine in previous versions of Flux v2.

Steps to reproduce

  1. Install Flux in a Kubernetes cluster
  2. Deploy a Helm Release through Flux; i.e I've used https://github.com/deliveryhero/helm-charts/blob/master/stable/kube-downscaler/values.yaml
  3. Manually change something in the deployment; i.e change the value of an ENV variable
  4. Wait to see if Flux overwrites the manual changes or also try to reconcile the Helm Release

Expected behavior

Flux changes the edited resource back to the state shown in the Git repos.

Screenshots and recordings

No response

OS / Distro

Linux

Flux version

v0.37.0

Flux check

► checking prerequisites
✗ flux 0.37.0 <0.38.2 (new version is available, please upgrade)
✔ Kubernetes 1.24.7-eks-fb459a0 >=1.20.6-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.27.0
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.27.0
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.23.0
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.31.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.29.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.32.1
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta1
✔ buckets.source.toolkit.fluxcd.io/v1beta1
✔ gitrepositories.source.toolkit.fluxcd.io/v1beta1
✔ helmcharts.source.toolkit.fluxcd.io/v1beta1
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta1
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta1
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta1
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1beta1
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta1
✔ receivers.notification.toolkit.fluxcd.io/v1beta1
✔ all checks passed

Git provider

GitHub

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kingdonb
Copy link
Member

kingdonb commented Jan 9, 2023

Duplicate of the pinned issue on Helm Controller:

This is on the roadmap for Flux 2.1 to solve. https://fluxcd.io/roadmap/#flux-helm-ga-q2-2023

(Its roadmap item is the one called "Atomic reconciliation of HelmReleases"

@kingdonb kingdonb closed this as completed Jan 9, 2023
@kingdonb kingdonb reopened this Jan 9, 2023
@kingdonb
Copy link
Member

kingdonb commented Jan 9, 2023

Not sure if I should "close this as completed" (nor as "not planned") – would edit the title to say "Helm Controller doesn't correct drift" if we are keeping it open here, (just to avoid accumulating more new reports of more duplicates from others who didn't think to check Helm Controller for an open issue.)

@stefanprodan stefanprodan changed the title Flux doesn't change drifted resources Helm: Flux doesn't change drifted resources Jan 18, 2023
@benjimin
Copy link

benjimin commented Feb 1, 2023

@Andrea-Gallicchio If your git repo contains a HelmRelease, it is the responsibility of flux to ensure that the HelmRelease in the cluster matches the HelmRelease in the repo.

If the corresponding Helm chart specifies for a deployment (or other kubernetes resources) to be created, it should be the responsibility of the helm controller (not fluxcd itself) to keep the direct child resources in sync with the HelmRelease.

This is analogous to how it is the responsibility of a ReplicaSet controller (not flux) to keep pods in sync with the ReplicaSet spec (and similarly for the Deployment controller). Unfortunately the helm controller does not currently perform this function (presumably owing to Helm having its own model for change management, different than both kubernetes and flux/gitops), but that's a separate issue (which has already been linked in the comment above).

@stefanprodan
Copy link
Member

You need to enable Helm drift detection, see https://fluxcd.io/flux/cheatsheets/bootstrap/#enable-helm-drift-detection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants