Repository navigation
Closed
Labels
Description
Unpack diffdemo.zip whose interesting part is
apiVersion: v1
kind: Secret
metadata:
name: x
type: Opaque
data:
{{- $existing := (lookup "v1" "Secret" .Release.Namespace "x" ) }}
{{- if $existing }}
text: {{ index $existing.data "text" }}
{{- else }}
text: {{ (randAlpha 10) | b64enc}}
{{- end }}and then run
$ helm install test .
NAME: test
LAST DEPLOYED: Mon Mar 1 09:13:24 2021
NAMESPACE: difftest
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
kubectl get secret --namespace difftest x -o go-template="{{.data.text | base64decode}}{{\"\n\"}}"
$ kubectl get secret --namespace difftest x -o go-template="{{.data.text | base64decode}}{{\"\n\"}}"
eLbQJJESrO
$ helm upgrade test .
Release "test" has been upgraded. Happy Helming!
NAME: test
LAST DEPLOYED: Mon Mar 1 09:13:37 2021
NAMESPACE: difftest
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
kubectl get secret --namespace difftest x -o go-template="{{.data.text | base64decode}}{{\"\n\"}}"
$ kubectl get secret --namespace difftest x -o go-template="{{.data.text | base64decode}}{{\"\n\"}}"
eLbQJJESrO
$ helm diff upgrade test .
difftest, x, Secret (v1) has changed:
# Source: diffdemo/templates/secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: x
data:
- text: '-------- # (10 bytes)'
+ text: '++++++++ # (10 bytes)'
type: Opaquehelm diff upgrade claims that secret/x would change if helm upgrade were run, when in fact it would not. See #176 and https://github.com/helm/charts/issues/5167#issuecomment-641558251.
(Helm 3.5.2, Microk8s 1.20.2, kubectl 1.20.4, helm-diff freshly installed so I suppose 3.1.3.)
Reacted by Meir Gabay, gjacobsatl, Karl-Aksel Puulmann, Carlos Mendes, Rickard, WojciechKarpiel, QuentinN42, James Roller, Jr., ahernandez-evi and tudoanm
Activity
jglick commentedon Mar 2, 2021
https://github.com/bacongobbler/helm-patchdiff does not seem to have this problem by the way.
unfor19 commentedon Mar 9, 2021
@jglick - Have you solved this one? I have the exact same case, though I'm using
.Release.IsInstallflag to make sure the secrets are generated only once, but the results are still the same as yours. Seems likelookup functionis not working.jglick commentedon Mar 9, 2021
@unfor19 no I have no particular workaround other than to tell people looking at the diff to please ignore apparent
Secretchanges.unfor19 commentedon Mar 9, 2021
Argh 😞 I intend to use it as part of a pipeline, so it's impossible to tell the pipeline "just ignore it" since I do want to take it into consideration.
Btw, if you want to suppress messages about secrets, you can add the following flag
Though it still means you'll get
Update- I've just checked and the lookup function returns an empty
map[], and it appears to be the default behavior according to the docsI guess
helm diffis no different thanhelm template, it simply cannot execute thelookupfunction. Adding the--show-secretsflag tohelm diffshows the correct values of the existing secrets, so it means thelookupfunction works but the diff is wrong, so maybe it's doable.jglick commentedon Mar 10, 2021
--suppress-secretsdoes not seem like a safe workaround, as otherSecrets not defined vialookupmay actually have changed, or their metadata might have changed, etc.I do not think so.
helm templateruns offline.helm diff upgrade, likehelm upgrade, contacts the cluster (unless you pass--dry-run).Not actually true, by the way: helm/helm#6901 (comment)
stale commentedon Jun 9, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
jglick commentedon Jun 14, 2021
I do not think this should be considered stale as it is an ongoing problem with no known workaround.
yelhouti commentedon Jul 5, 2021
Facing the same problem here, while using helmfile which uses helm diff under the hood.
rickardp commentedon Aug 23, 2021
Are there any plans to actually fix this? I didn't take it if you thought it went agains the design goals or if this is to be treated as a bug?
I suppose this could be viewed as blocked by helm/helm#8137? What is the opionion of the maintainers here?
databus23 commentedon Aug 24, 2021
Exactly, while I would love to have support for the lookup function there is no support for that in the upstream
helmbinary.I'm super hesitant to reimplement the template render logic in this plugin because then this needs to be kept up-to-date with template functions provided by newer helm versions. In fact this plugin would have to release matching versions for each version of helm that has a change in its "template language". Also using newer versions of this plugin with older helm versions would lead to inaccurate results as functions supported by the diff plugin would not be when performing the upgrade (using the helm binary).
It was a conscious decision to not "vendor" the rendering of the template into this plugin when adding support for helm3 when everything went client-side: #149 (comment).
So as long as there is no support for extracting the correctly rendered output from the helm binary I don't see how to make progress on this issue.
rickardp commentedon Aug 24, 2021
That makes sense. Let's all help out getting the dry-run fix merged then, looks like a PR has been published but not yet reviewed.
stale commentedon Jan 8, 2022
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
mumoshu commentedon Jan 9, 2022
We now have the ability to use
helm upgrade --dry-runinstead ofhelm templateto render the chart (#330). Andupgrade --dry-runseems to have a chance to get cluster access(even though it doesn't look exactly like what I'd expect for adry-runoperation...So, this should be possible with HELM_DIFF_USE_UPGARDE_DRY_RUN=true once helm/helm#9426 gets merged upstream.
mumoshu commentedon Jan 9, 2022
@databus23 I agere and support this. And I have a slightly related discussion to bring in here.
In #304, we did introduce dependencies to helm and k8s.io related packages in our three-way merge work. This requires us to keep those dependencies up-to-date. We rely on those dependencies only for converting YAML doc to K8s resource objects and doing three-wary-merging, but template rendering.
The part that converts YAML doc to K8s resource objects won't change that often as long as you mostly use stable K8s APIs(apps/v1, ingress/v1, core/v1, etc). Probably it's similar for the three-way merge logic, too. So I think it's fine to introduce helm and k8s deps.
But the template renderer changes often in Helm v3, when e.g. a new helm version gets new template functions. So reimplementing the renderer in helm-diff would be a maintenance nightmare.
stale commentedon Apr 16, 2022
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
scubbo commentedon Oct 15, 2022
Commenting to make this not-stale (I came here from here - if there's a better place to track this, please let me know!) - I'm still encountering this issue on Helm commit
414ff28d4029ae8c8b05d62aa06c7fe3dee2bc58, and it looks like the PR has still not been merged.EDIT: Oh, it's closed, which appears to be irreversible. I'm still getting used to Github Issues, sorry!
MichaelMorrisEst commentedon Apr 11, 2023
FYI, I have created a new issue to progress this and plan to submit a PR once the helm PR is merged
#449