You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to debug "lookup" function, as its disabled with helm template #8137
I would like to have a discussion as to why I can't use helm template to debug my chart, as that, in my opinion, should be the primary purpose of having a template command.
Reacted by raffaelespazzoli, Karl Moos, Alexander Berger, Alex Kreidler, Daniel Hoherd, David Cowden, Marcel Michelfelder, Liri "Really" Sokol, Bar Harel, Lior Bachar and 48 more
It is intentional behaviour for lookup to return with an empty dictionary during a helm template, as it is expected that the chart renders without any cluster connection. See #7955 and #7969 for more details.
If you want to test your chart using a live connection with the cluster, either add the --validate flag or use helm install --dry-run.
Neither help template --validate nor helm install --dry-run help in debugging a function that essentially is skipped.
The problem is that the lookup function should not simply be "skipped" if using helm template. Instead, it should handle the case where there is no active connection, and return a nil value so that those who wish to use the function still can. I shouldn't have to make changes to my chart based on whether I'm going to use helm template or helm install to process it.
Please re-open this issue.
Reacted by Constantin Bugneac, Andrew Beekhof, l-qing, Lorenzo, Yusukee, Raheleh Gilani, tadrian88, Jacob Danovitch, Jade Ahking, Alejandro Escobar and 9 more
@bacongobbler I get what I have to do to handle the lookup in my template. What I'm saying is that when I run helm install with my template and lookup actually returns something, I have no way of seeing the content that is generated and therefore can't troubleshoot the formatting issues, and helm install --dry-run gives me no extra information.
Normally, I would run helm template to see what's generated, but in this case, I can't.
Reacted by Constantin Bugneac, Dominik Zöchbauer, Lorenzo, Yusukee, druesendieb and matejkostros
$ helm version
version.BuildInfo{Version:"v3.2.1", GitCommit:"fe51cd1e31e6a202cba7dead9552a6d418ded79a", GitTreeState:"clean", GoVersion:"go1.13.10"}
$ kubectl run nginx --image nginx
$ helm create test-lookup
$ cd test-lookup
$ cat templates/deployment.yaml | head -n 6
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "test-lookup.fullname" . }}
labels:
{{ with lookup "v1" "Pod" "default" "nginx" }}testing: {{ quote .metadata.name }}{{ end }}
helm template --validate and helm install --dry-run both show empty output. helm install shows the correct output, of course. Perhaps #7969 unintentionally disabled the lookup function for cases where we do have cluster access.
Reacted by Vladyslav Miletskyi, gmoshiko, Joseph Mente, Ryan, Liri "Really" Sokol, David Lo, Matthew Allen Moltzau, Marcus T, Kiss Stefan, Paragon1970 and 9 more
@technosophos what exactly is the security concern with the lookup plugin? I could see there being a concern if we were talking about helm v2, where tiller was still involved, but with helm 3 being all in the client side, running a lookup through helm template doesn't expose anything that the user couldn't already see with kubectl get.
Reacted by Constantin Bugneac, Lorenzo, Ovi Calbajos, David Cowden, Andreas Böhrnsen, Sergei Kuzmin, benedikt-bartscher, Elton de Souza, Matthias Hörmann, matejkostros and 3 more
I agree this is a vulnerability when using helm template as helm template command should not interact with the cluster at all(which make me a lot of problem as I am using systems like ArgoCD which use helm template command before deploying to the cluster), but the lookup function is not working also with install --dry-run which makes it impossible to debug and not making sense as --dry-run is expected to interact with the cluster.
it cant be expected to debug a feature only when installing or upgrading. I'm literally using an old helm3 binary with the vulnerability so I can debug this before installing it with the latest helm3 binary.
is there any security reason why it shouldn't work with --dry-run or helm template with --validate?
Dry-run is NOT expected to interact with the cluster, and this is documented. All other similar functions and capabilities are also disabled for --dry-run.
How about using helm install --dry-run=server-lookup-only for current behavior
and reserve helm install --dry-run=server for future "all server-side validations and majic" ?
How about using helm install --dry-run=server-lookup-only for current behavior
and reserve helm install --dry-run=server for future "all server-side validations and majic" ?
This was discussed for two years before being merged. Let's just celebrate that something was agreed upon 😀
Activity
bacongobbler commentedon May 15, 2020
Have you tried
helm template --validate?It is intentional behaviour for
lookupto return with an empty dictionary during ahelm template, as it is expected that the chart renders without any cluster connection. See #7955 and #7969 for more details.If you want to test your chart using a live connection with the cluster, either add the
--validateflag or usehelm install --dry-run.Hope this helps.
etsauer commentedon May 15, 2020
Neither
help template --validatenorhelm install --dry-runhelp in debugging a function that essentially is skipped.The problem is that the lookup function should not simply be "skipped" if using
helm template. Instead, it should handle the case where there is no active connection, and return a nil value so that those who wish to use the function still can. I shouldn't have to make changes to my chart based on whether I'm going to usehelm templateorhelm installto process it.Please re-open this issue.
bacongobbler commentedon May 15, 2020
As shown in your error message, it is clearly returning a nil value. Your template isn’t handling that nil and assumed it was a populated object.
Wrap your
lookupin aniforwithclause to handle the nil case.etsauer commentedon May 15, 2020
@bacongobbler I get what I have to do to handle the lookup in my template. What I'm saying is that when I run
helm installwith my template andlookupactually returns something, I have no way of seeing the content that is generated and therefore can't troubleshoot the formatting issues, andhelm install --dry-rungives me no extra information.Normally, I would run
helm templateto see what's generated, but in this case, I can't.bacongobbler commentedon May 15, 2020
Tested and confirmed with the following:
helm template --validateandhelm install --dry-runboth show empty output.helm installshows the correct output, of course. Perhaps #7969 unintentionally disabled thelookupfunction for cases where we do have cluster access.What's your thoughts on this, @technosophos?
etsauer commentedon May 15, 2020
cc: @raffaelespazzoli
etsauer commentedon May 19, 2020
@bacongobbler @technosophos bump.
technosophos commentedon May 20, 2020
Lookup is intentionally disabled for security reasons. There is no plan to change this behavior.
etsauer commentedon May 21, 2020
@technosophos what exactly is the security concern with the lookup plugin? I could see there being a concern if we were talking about helm v2, where tiller was still involved, but with helm 3 being all in the client side, running a lookup through
helm templatedoesn't expose anything that the user couldn't already see withkubectl get.technosophos commentedon May 21, 2020
The security disclosure: GHSA-q8q8-93cv-v6h8
gmoshiko commentedon May 24, 2020
I agree this is a vulnerability when using helm template as helm template command should not interact with the cluster at all(which make me a lot of problem as I am using systems like ArgoCD which use helm template command before deploying to the cluster), but the lookup function is not working also with install --dry-run which makes it impossible to debug and not making sense as --dry-run is expected to interact with the cluster.
it cant be expected to debug a feature only when installing or upgrading. I'm literally using an old helm3 binary with the vulnerability so I can debug this before installing it with the latest helm3 binary.
is there any security reason why it shouldn't work with --dry-run or helm template with --validate?
technosophos commentedon May 26, 2020
Dry-run is NOT expected to interact with the cluster, and this is documented. All other similar functions and capabilities are also disabled for
--dry-run.99 remaining items
Feat/lookup dryrun (#1)
curlup commentedon Sep 11, 2023
How about using
helm install --dry-run=server-lookup-onlyfor current behaviorand reserve
helm install --dry-run=serverfor future "all server-side validations and majic" ?rickardp commentedon Sep 16, 2023
This was discussed for two years before being merged. Let's just celebrate that something was agreed upon 😀
feat(helm): add ability for --dry-run to do lookup functions
feat(helm): add ability for --dry-run to do lookup functions
feat(helm): add ability for --dry-run to do lookup functions
feat(helm): add ability for --dry-run to do lookup functions
feat(helm): add ability for a dry-run to evaluate lookup functions
feat(helm): add ability for a dry-run to evaluate lookup functions
feat(helm): add ability for --dry-run to do lookup functions
feat(helm): add ability for --dry-run to do lookup functions
feat(helm): add ability for --dry-run to do lookup functions
Update dependency helm to v3.13.2 (#13)
revise lookup - per Helm helm/helm#8137