Skip to content

detect/report drift: compare desired with actual state #508

Open

Description

@patrikbeno

Compare deployed helm release with actual live/runtime manifests, and report changes (drift).

This is a missing feature at the moment (v3.8.1), helm-diff only works with releases/revisions.

I guess this task would require fetching actual manifest referenced by helm release/revision and compare desired with actual state, and helm-diff is very close to supporting this.

Activity

  1. gustavobini commented on Nov 17, 2023

    @gustavobini

    I might have misunderstood this issue, but is this not what it does right now when doing an upgrade --dry-run?

  2. patrikbeno commented on Nov 18, 2023

    @patrikbeno
    Author

    @gustavobini , no. upgrade --dry-run shows all manifests in their TO-BE state. Proposed feature is about comparing AS-IS state with desired helm revision, and showing only DIFF.

    Also note that helm upgrade needs local helm chart workspace. helm diff release/revision (which is the target of this proposal) does not need one, it works with k8s cluster only.

  3. patrikbeno commented on Nov 18, 2023

    @patrikbeno
    Author

    The use case I had in mind is this:

    helm install my-release .
    
    # manual edit some resource deployed by my-release
    kubectl edit ... 
    
    # compare actual runtime manifests with revision 1 of my-release; i.e. show changes I made in previous kubectl-edit
    helm diff revision my-release 1 runtime
    

    runtime may be a keyword here; since revisions are integers, this keyword would tell helm-diff to take manifests from actual runtime, not from any specific revision.

  4. itaispiegel commented on Nov 28, 2023

    @itaispiegel

    My team also needs this feature so I'd like to thumbs up this issue 👍🏻

  5. itaispiegel commented on Nov 28, 2023

    @itaispiegel

    Just looked into it and I think this is solved by using the --three-way-merge flag. At first I didn't understand the meaning of this flag, but then I found this documentation.

  6. patrikbeno commented on Jan 28, 2024

    @patrikbeno
    Author

    Just looked into it and I think this is solved by using the --three-way-merge flag. At first I didn't understand the meaning of this flag, but then I found this documentation.

    --three-way-merge looks promising, but helm-diff-upgrade is missing --force

  7. raymondregrello commented on Aug 28, 2025

    @raymondregrello

    +1, if helm diff with--three-way-merge behaves like helm's three way merge algorithm, I don't think it will fully surface all manual changes that have been made.

    E.g. if the live manifest has replicas: 3 and the Helm release specifies replicas: 1, helm diff upgrade --three-way-merge should report the full diff:

    -  replicas: 1
    +  replicas: 3
    

    However the docs for helm's three way merge give this example:

    If the live is state is this:

    containers:
    - name: server
      image: nginx:2.0.0
    - name: my-injected-sidecar
      image: my-cool-mesh:1.0.0
    

    And the helm release specifies:

    containers:
    - name: server
      image: nginx:2.1.0
    

    I would only expect helm diff upgrade --three-way-merge to report the diff as:

    -  image: nginx:2.0.0
    +  image: nginx:2.1.0
    

    Assuming this is the case (please correct me if not!), it would be great to have an option that shows the full changes that helm upgrade --force would make (as @patrikbeno said), which should include removing the sidecar container.

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