databus23 / helm-diff

A helm plugin that shows a diff explaining what a helm upgrade would change

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`diff uninstall` command

gytis-ivaskevicius opened this issue · comments

I am using this project in custom tooling and I wanted to ask if there are plans to add a feature which would show the whole state that is about to be removed before executing helm uninstall

Sounds like a good idea to me!

I'm not sure I understand what is requested. Can't you just do a helm get manifest to learn about all the resources that are about to be removed? How would this be different?

@databus23 @yxxhero I'd love clarification from @gytis-ivaskevicius, but my understanding is this-

When you build a custom tool around helm-diff, it can produce diff not only on helm install/upgrade but also on uninstall.

Instead of doing helm get manifest followed by a difflib call, one wants something like helm diff uninstall that exactly does that for you. It makes integration with helm-diff from the custom tooling easier, as it does not need to directly depend on the version of difflib that helm-diff depends on and does not need to care about how helm-diff produces diffs.

...Well, thinking more and more about this seems to tell me that this isn't strictly needed, a nice-to-have feature to helm-diff 😺

@databus23 @yxxhero What are your thoughts? We'd better NOT add this?

When you build a custom tool around helm-diff, it can produce diff not only on helm install/upgrade but also uninstall.

Yep, that's right. And yes, it's more of a nice-to-have feature

I did not consider the idea of running helm get manifest and performing a little bit of magic to make it seem like a removal diff but that would solve my issue

@gytis-ivaskevicius Thanks for confirming! Ok then! FYI, here's how we compare current and desired manifests one by one:

return difflib.Diff(split(before, stripTrailingCR), split(after, stripTrailingCR))

We basically build a map of manifest names to manifest contents, for the desired and the current state, and compare them one by one using difflib.
Your solution could be much simpler because you can just parse the helm get manifest output and run difflib diff against the empty string for each parsed manifest.