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

helm lint fails when global values are used in subcharts #8489

Closed
allanlewis opened this issue Jul 20, 2020 · 10 comments · May be fixed by #8514
Closed

helm lint fails when global values are used in subcharts #8489

allanlewis opened this issue Jul 20, 2020 · 10 comments · May be fixed by #8514

Comments

@allanlewis
Copy link

When using global chart values, helm lint complains about the global key not being present in the subchart, even though it's supposed to be reserved and available to subcharts. Actually building the chart works, it's just the linter that complains. The error is like this:

[ERROR] templates/: template: <chart>/templates/<filename>.yaml:<line>:<char>: executing "<chart>/templates/<filename>.yaml" at <.Values.global.foo>: map has no entry for key "global"

Output of helm version:

version.BuildInfo{Version:"v3.2.4", GitCommit:"0ad800ef43d3b826f31a5ad8dfbb4fe05d143688", GitTreeState:"clean", GoVersion:"go1.13.12"}

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.12", GitCommit:"a8b52209ee172232b6db7a6e0ce2adc77458829f", GitTreeState:"clean", BuildDate:"2019-10-15T12:12:15Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.7", GitCommit:"6f482974b76db3f1e0f5d24605a9d1d38fad9a2b", GitTreeState:"clean", BuildDate:"2019-03-25T02:41:57Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.): n/a

@allanlewis
Copy link
Author

Adding empty values in the subchart keeps helm lint happy:

global:
  foo: ""

@mattfarina
Copy link
Collaborator

Can you try this with v3.3.0-rc.1? I tried to replicate the problem there and was unable to.

@allanlewis
Copy link
Author

Can you try this with v3.3.0-rc.1?

helm version
version.BuildInfo{Version:"v3.3.0-rc.1", GitCommit:"5c2dfaad847df2ac8f289d278186d048f446c70c", GitTreeState:"dirty", GoVersion:"go1.14.4"}

helm lint still fails if I use --with-subcharts, or lint the sub-chart directly.

I can reproduce this with v3.1.3, v3.2.4 and now v3.3.0-rc.1.

My specific use-case is that the parent chart has this in values.yaml:

global:
  hostname: foobar.com

The sub-chart then uses global.hostname in a template, which works due to the special behaviour of the global key, as documented. However, helm lint complains about this, as per my original report, unless I add this to the sub-chart's values.yaml:

global:
  hostname: ""

@wawa0210
Copy link
Contributor

I reproduced this issue, as @allanlewis said, only need to specify --with-subcharts when helm lint is required to recreate it. I can try to follow up on this issue and propose a pr solution

/assign

the ref #7288

@ahmadalli
Copy link

ahmadalli commented Oct 3, 2020

I have a similar issue on helm 3.3.4: I can't use subchart values on the main chart on lint. install or template works file though

@github-actions
Copy link

github-actions bot commented Jan 2, 2021

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

@github-actions github-actions bot added the Stale label Jan 2, 2021
@Ziphone
Copy link

Ziphone commented Jan 8, 2021

helm version

version.BuildInfo{Version:"v3.4.2", GitCommit:"23dd3af5e19a02d4f4baa5b2f242645a1a3af629", GitTreeState:"dirty", GoVersion:"go1.15.5"} 

I have a similar issue when using dependency charts.

I experience a similar error ("Additional property global is not allowed"), unless I modify the values.schema.json of the dependency chart. I add "global": {} to the properties of the root object of values.schema.json of the dependency chart, and then it works.

@github-actions github-actions bot removed the Stale label Jan 9, 2021
@github-actions
Copy link

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

@rvarun11
Copy link

Still facing this issue with latest Helm version. Can this issue be reopened?

@felipecrs
Copy link

I add "global": {} to the properties of the root object of values.schema.json of the dependency chart, and then it works.

BTW this only works if your subcharts are not trying to access nested objects within global. If you have a subchart that's trying to access something like global.image.tag, you also have to set:

global:
  image: {}

Which can be very boring depending on the chart. The PR below fixes the issue:

And it was very simple. Too bad it never got merged.

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

Successfully merging a pull request may close this issue.

7 participants