nikhilsbhat / helm-drift

Helm plugin that identifies the configuration that has drifted from the Helm chart
https://artifacthub.io/packages/helm-plugin/helm-drift/drift
MIT License
68 stars 10 forks source link

Flag for excluding resources from detection #16

Closed victorswed closed 3 months ago

victorswed commented 8 months ago

I have a scenario where I use hooks "helm.sh/hook: pre-install, pre-upgrade" and I want to exclude those resources, it can be based on KIND e.g "Job", "Deployment" etc.

nikhilsbhat commented 8 months ago

@victorswed, If you want to include hooks while filtering by resource type, run the command with the flags --consider-hooks and --kind, where the --kind parameter accepts multiple inputs.

victorswed commented 8 months ago

@nikhilsbhat Thank you, Basically what I want to achieve is to exclude Job from the drift detection, due to the helm.sh/hook: pre-install, pre-upgrade hook, the resource (in my case is Job) is not managed by the release, thus causing always a drift in the job resource, I want to exclude Job from the drift detection, https://helm.sh/docs/topics/charts_hooks/#hook-resources-are-not-managed-with-corresponding-releases.

victorswed commented 8 months ago

I found the flag --skip, but I have a different issue, where HPA in place and replicas change it finds a drift is it possible to --skip specific field from a resource?

nikhilsbhat commented 8 months ago

@victorswed, I'm not sure if it is feasible to skip certain fields while identifying drifts with current code.

The way the plugin handles the resources currently, doesn't support adding such features. To support this, I'll have to change the core logic of it. I'll see if this is possible when I have some time.

nikhilsbhat commented 3 months ago

The issue of drifts caused by HPA is addressed in commit https://github.com/nikhilsbhat/helm-drift/commit/5dd8d4e554980be66a893295e75c8419f44e519d. This commit resolves the problem using a different approach instead of skipping the field hence closing this.