helmwave icon indicating copy to clipboard operation
helmwave copied to clipboard

Helmwave diff live does not seem to do 3-way diff

Open samavasi opened this issue 2 years ago • 2 comments

This is mainly a question , as we observed after deleting manually a resource from a deployed chart , diff (live mode) doesnt show the live object as missing/added. Is there support for 3-way diff against live k8s objects (i.e. not live state of helm release secret)?

samavasi avatar Oct 13 '22 06:10 samavasi

Yep, it's because helm diff and helm returns manifest from HELM_DRIVER (k8s secrets). We don't have ideas on how to do it natively.

I see only 1 option today: Calling kube client behind the helm.

zhilyaev avatar Oct 13 '22 19:10 zhilyaev

Right now we use helm get manifest to get current release manifests. And it doesn't reflect any changes made as it just returns previously applied manifests (stored in secret) We can try to use helm upgrade --dry-run --reuse-values. This way helm should run its 3-way merge

r3nic1e avatar Oct 19 '22 20:10 r3nic1e

@r3nic1e nice trick!

zhilyaev avatar Nov 09 '22 09:11 zhilyaev

I've tried to do trick with helm upgrade --dry-run --reuse-values - it doesn't do much. Works like current code

I've also checked what does helm-diff do - https://github.com/databus23/helm-diff/blob/c5d10a3e91f4ac3882eec23b7b35871eaeb9e895/cmd/upgrade.go#L243

Long story short: helm-diff prepares kubectl-like patch with lots of marshaling and unmarshaling

r3nic1e avatar Nov 23 '22 17:11 r3nic1e

@samavasi you can try to use it with the new experimental --3-way-merge flag (or HELMWAVE_DIFF_3_WAY_MERGE envvar). But it may output a lot of generated fields (like uid, timestamps, etc.)

r3nic1e avatar Dec 03 '22 16:12 r3nic1e