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

[kube-prometheus-stack] templating error when overriding prometheus-node-exporter in values #5246

Open
jonkerj opened this issue Jan 29, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@jonkerj
Copy link
Contributor

jonkerj commented Jan 29, 2025

Describe the bug a clear and concise description of what the bug is.

I'm trying to deploy K-P-S without deploying node-exporter but with servicemonitors et al for node-exporter, which leads to templating errors.

What's your helm version?

v3.9.2

What's your kubectl version?

v1.29.0

Which chart?

kube-prometheus-stack

What's the chart version?

68.3.3

What happened?

$ helm template -f values.yaml kps prometheus-community/kube-prometheus-stack
Error: template: kube-prometheus-stack/templates/prometheus/clusterrole.yaml:32:55: executing "kube-prometheus-stack/templates/prometheus/clusterrole.yaml" at <"prometheus-node-exporter">: nil pointer evaluating interface {}.enabled

Use --debug flag to render out invalid YAML

What you expected to happen?

See a bunch of templates happily rendered

How to reproduce it?

$ helm template -f values.yaml kps prometheus-community/kube-prometheus-stack

Enter the changed values of values.yaml?

nodeExporter:
  enabled: false
prometheus-node-exporter:
  prometheus:
    monitor:
      interval: 30s

Enter the command that you execute and failing/misfunctioning.

$ helm template -f values.yaml kps prometheus-community/kube-prometheus-stack

Anything else we need to know?

If I remove the last four lines of my values, the chart templates fine, so it must be something with prometheus-node-exporter. It looks like the defaults of subchart prometheus-node-exporter do not get merged well with my values, resulting in kubeRBACProxy not being present under .Values.prometheus-node-exporter when specifying overrides. So it could be a helm bug, or PEBKAC (should I escape my key [is that even possible?] because of the -?).

@jonkerj jonkerj added the bug Something isn't working label Jan 29, 2025
@zeritti
Copy link
Contributor

zeritti commented Jan 30, 2025

Your configuration is disabling the prometheus-node-exporter subchart and setting field prometheus-node-exporter which is now entirely unrelated to the subchart.

Helm attempting to evaluate a pipeline in the conditional in the prometheus/clusterrole.yaml template fails. The conditional itself is referring to a path which does not exist in your current configuration. You can work around that by adding that field. Helm will not raise an error but will not output anything of the desired subchart as it has been disabled.

The error can be reproduced with helm release 3.9. With release 3.10+ helm does not fail in this case any longer - it produces no output of the disabled subchart, as one might expect.

@zeritti zeritti changed the title [prometheus-kube-stack] templating error when overriding prometheus-node-exporter in values [kube-prometheus-stack] templating error when overriding prometheus-node-exporter in values Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants