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

ServiceMonitor metricRelabelings not correctly templated #771

Open
dhhuynh2 opened this issue Dec 9, 2022 · 0 comments
Open

ServiceMonitor metricRelabelings not correctly templated #771

dhhuynh2 opened this issue Dec 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@dhhuynh2
Copy link

dhhuynh2 commented Dec 9, 2022

Describe the bug

When setting metricRelabelings, helm will fail when installing the chart with the following error:

  Error: YAML parse error on jenkins/templates/jenkins-controller-servicemonitor.yaml: error converting YAML to JSON: yaml: line 19: did not find expected ',' or ']'

Version of Helm and Kubernetes

- Helm: v3.8.0
- Kubernetes: v1.20.15

Chart version

4.2.15

What happened?

  1. Set values.json as such below (example):
...
controller:
  ...
  prometheus:
    enabled: true
    ...
    metricRelabelings:
      - sourceLabels: [__name__]
        regex: "some_regex_(.*)"
        targetLabel: "someLabel"
      - sourceLabels: [__name__]
        regex: "another_regex(.*)"
        targetLabel: "anotherLabel"
  1. Installed the chart.

  2. Received:

Error: YAML parse error on jenkins/templates/jenkins-controller-servicemonitor.yaml: error converting YAML to JSON: yaml: line 19: did not find expected ',' or ']'

What you expected to happen?

Chart should be correctly installed without YAML validation errors.

How to reproduce it

Reproduced by locally templating jenkins/templates/jenkins-controller-servicemonitor.yaml file with my values.json values.

Anything else we need to know?

After digging into the template, I see this is where it's being set:

metricRelabelings: {{ .Values.controller.prometheus.metricRelabelings }}

Since metricRelabelings is a list of maps, I believe this should be invoking toYaml as such:

{{- toYaml .Values.controller.prometheus.metricRelabelings | trim | nindent 6 }}

I've noticed an open PR that should resolve this in #638 if merged.

@dhhuynh2 dhhuynh2 added the bug Something isn't working label Dec 9, 2022
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

1 participant