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

3-way diff doesn't appear to be working when using helm diff upgrade #521

Closed
TJM opened this issue Mar 2, 2020 · 2 comments
Closed

3-way diff doesn't appear to be working when using helm diff upgrade #521

TJM opened this issue Mar 2, 2020 · 2 comments
Labels

Comments

@TJM
Copy link

TJM commented Mar 2, 2020

ISSUE: We thought that with helm3, we would be able to validate the desired state of helm charts, per the documentation ( https://helm.sh/docs/faq/#improved-upgrade-strategy-3-way-strategic-merge-patches ), it would appear that setting something like "replicas" would be validated against the live status, even if there was not an apparent change in the chart.

I am going to assume requisite access to a kubernetes cluster. In our case, it is vanilla kubernetes v 1.16.3.

NOTE, we are using helm 3.1.1:

$ helm version
version.BuildInfo{Version:"v3.1.1", GitCommit:"afe70585407b420d0097d07b21c47dc511525ac8", GitTreeState:"clean", GoVersion:"go1.13.8"}

Steps to reproduce:

  • Install simple helm chart (such as cerebro):
$ helm install cerebro stable/cerebro
NAME: cerebro
LAST DEPLOYED: Mon Mar  2 12:57:03 2020
NAMESPACE: test
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace test -l "app=cerebro,release=cerebro" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl port-forward $POD_NAME 8080:80
  • Validate
$ k get po
NAME                       READY   STATUS    RESTARTS   AGE
cerebro-64df774f86-748fd   1/1     Running   0          2m5s
  • Someone "accidentally" changes deployment replicas to 0
$ k get deployment
NAME      READY   UP-TO-DATE   AVAILABLE   AGE
cerebro   1/1     1            1           6m23s
$ k scale --replicas=0 deployment/cerebro
deployment.apps/cerebro scaled
$ k get deployment
NAME      READY   UP-TO-DATE   AVAILABLE   AGE
cerebro   0/0     0            0           6m46s
$ k get po
No resources found.
  • Now helm diff upgrade should see changes, right?
$ helm diff upgrade cerebro stable/cerebro
test, cerebro, ConfigMap (v1) has changed:
  # Source: cerebro/templates/configmap.yaml
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: cerebro
    labels:
      app: cerebro
      chart: cerebro-1.4.0
      release: cerebro
      heritage: Helm
  data:
    application.conf: |-
-     secret = "B0vjQwsjYCDTXg2VI95cA9n3HV9u8ph5ssZrC3WW0Cpc0KuhITclMQA1N0n88n4H"
+     secret = "nuZcG2IQLkxHU1XhC1aq525KFhlLswMzE3c8ocj3TEoUY8nfiZ6aOdckPyOL5LuN"

(SNIP)

OK, auto-generated cookie secret, will "set" that

  • How about now, changes?
$ helm diff upgrade cerebro stable/cerebro --set config.secret='B0vjQwsjYCDTXg2VI95cA9n3HV9u8ph5ssZrC3WW0Cpc0KuhITclMQA1N0n88n4H'
#(((NO OUTPUT, NO DIFF)))

NO :(

  • Lets try just upgrade anyhow...
$ helm upgrade cerebro stable/cerebro --set config.secret='B0vjQwsjYCDTXg2VI95cA9n3HV9u8ph5ssZrC3WW0Cpc0KuhITclMQA1N0n88n4H'
Release "cerebro" has been upgraded. Happy Helming!
NAME: cerebro
LAST DEPLOYED: Mon Mar  2 13:33:04 2020
NAMESPACE: test
STATUS: deployed
REVISION: 3
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace test -l "app=cerebro,release=cerebro" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl port-forward $POD_NAME 8080:80
  • Interesting, it is back
$ k get po
NAME                       READY   STATUS    RESTARTS   AGE
cerebro-6597b49cdc-2zlqn   1/1     Running   0          2m23s

So, upgrade works, but diff doesn't show any changes? Am I doing something incorrectly, or is this a bug?

~tommy

@bacongobbler
Copy link
Member

helm diff is a plugin created by members of the community. It was originally written against helm 2. They will likely need to introduce a feature flag to helm diff that calculates the diff using a three-way merge patch strategy.

Can you open this as a feature request for the helm diff plugin?

https://github.com/databus23/helm-diff

Closing as this is a feature request for a plugin maintained by the community. Please open a new ticket over at helm-diff.

Thanks!

@Ga13Ou
Copy link

Ga13Ou commented Jan 10, 2022

I think that this feature should be integrated to the helm diff release as well, In fact when you compare two release in which one of them has been manually modified, you don't have such modification shown in the output. Correct me if I missed something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants