roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.05k stars 565 forks source link

Helmfile apply does not install deleted resources #2013

Closed schollii closed 2 years ago

schollii commented 2 years ago

Steps to reproduce :

  1. Install a new set of releases via helmfile apply
  2. Use kubectl to delete one of the resources created for one of the released apps, eg kubectl delete svc APP1_NAME
  3. Run helmfile apply again: I would expect it to see (when it does a diff) that svc APP1_NAME is missing, and therefore desired state is different from current k8s state, and so I expected it to run a helm upgrade on the app for which k8s resource was deleted. But it does not do that.

There's a chance this is a helm or even helm diff issue (or helmfile diff but I think it uses helm diff plugin), I will see if I can dig some more but meanwhile, I thought this might just be a known limitation or issue.

andrewnazarov commented 2 years ago

More likely it's related to this one and how helm-diff works. IIRC it makes a diff against a Helm state stored in secrets. Because of this, we started thinking of switching to helmfile sync.

mumoshu commented 2 years ago

@schollii @andrewnazarov Probably this would work with the new --three-way-merge option added to helm-diff recently.

https://github.com/databus23/helm-diff/pull/304

schollii commented 2 years ago

Thanks for letting me know @mumoshu. Looks like that could be the solution.

Helmfile doesn't support configuring how it calls helm diff, IIRC... so it'll be a few weeks before this is available in helmfile correct?

mumoshu commented 2 years ago

@schollii You're almost correct but this time I made it configurable via an envvar (https://github.com/databus23/helm-diff/pull/336) too. That means you'll be able to enable the new behavior by running helmfile with HELM_DIFF_THREE_WAY_MERGE=true as helm-diff processes inherit env from the helmfile process.

mumoshu commented 2 years ago

FYI, helm-diff v3.3.0 has been released with the new three-way-merge option 😃