Skip to content

diff uninstall command #515

Open
Open

Description

@gytis-ivaskevicius

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

Activity

  1. yxxhero commented on Jan 17, 2024

    @yxxhero
    Collaborator
  2. mumoshu commented on Jan 17, 2024

    @mumoshu
    Collaborator

    Sounds like a good idea to me!

  3. databus23 commented on Jan 17, 2024

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

  4. mumoshu commented on Jan 22, 2024

    @mumoshu
    Collaborator

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

  5. gytis-ivaskevicius commented on Jan 29, 2024

    @gytis-ivaskevicius
    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

  6. mumoshu commented on Jan 29, 2024

    @mumoshu
    Collaborator

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions