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

Cluster-state drift detection

Open hiddeco opened this issue 1 year ago • 32 comments

:mega: Announcement

We are excited to announce a new (long requested) feature in the helm-controller - drift detection! This is now available in >=v0.37.0, and can be enabled by configuring a HelmRelease with .spec.driftDetection.mode set to enabled.

To enable drift detection without correction, set .mode to warn.

:mag_right: What is drift detection?

Drift detection allows you to detect any unintentional changes to a resource in your Kubernetes cluster that may have occurred outside of your Helm release process. The feature uses the same approach as kustomize-controller to detect drift by performing a dry-run Server Side Apply of the rendered manifests of a release. When drift is detected, the controller will emit an Event and recreate and/or patch the Kubernetes resources.

:boom: Current limitations

  • The detected diff is only logged in the controller logs when --log-level is set to debug. In the Kubernetes Event, only the creation or change of a Kubernetes resource is reported with a brief summary of the changes.
  • There is no flux diff command available (yet) to manually inspect or detect drift.

:books: References

  • Drift detection: https://fluxcd.io/flux/components/helm/helmreleases/#drift-detection
  • Drift correction: https://fluxcd.io/flux/components/helm/helmreleases/#drift-correction
  • Ignore rules: https://fluxcd.io/flux/components/helm/helmreleases/#ignore-rules

:phone: Request for Feedback

Please note that this feature is still in its early stages and lacks certain UX features. However, we encourage you to try it out and provide feedback on your experience with it, including any issues you encounter or suggestions for improvements.

Thank you for your help in making the controller even more powerful and reliable!

hiddeco avatar Mar 10 '23 16:03 hiddeco