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

diff uninstall command #515

Open
gytis-ivaskevicius opened this issue Dec 28, 2023 · 6 comments
Open

diff uninstall command #515

gytis-ivaskevicius opened this issue Dec 28, 2023 · 6 comments

Comments

@gytis-ivaskevicius
Copy link

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

@yxxhero
Copy link
Collaborator

yxxhero commented Jan 17, 2024

@mumoshu @databus23 WDTY?

@mumoshu
Copy link
Collaborator

mumoshu commented Jan 17, 2024

Sounds like a good idea to me!

@databus23
Copy link
Owner

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?

@mumoshu
Copy link
Collaborator

mumoshu commented Jan 22, 2024

@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?

@gytis-ivaskevicius
Copy link
Author

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

@mumoshu
Copy link
Collaborator

mumoshu commented Jan 29, 2024

@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.

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