prometheus-community / helm-charts

Prometheus community Helm charts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[prometheus-elasticsearch-exporter] Unexpected handling of imagepullsecrets

JKrehling opened this issue · comments

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

#2039

Back in this MR there was a template function added to parse imagePullSecrets.
I went from using the prometheus-elasticsearch-exporter on 4.11.0 to 5.8.0 and saw

prometheus-elasticsearch-exporter/templates/deployment.yaml: error converting YAML to JSON: yaml: line 30: mapping values are not allowed in this context helm.go:84: [debug] error converting YAML to JSON: yaml: line 30: mapping values are not allowed in this context YAML parse error on charts/prometheus-elasticsearch-exporter/templates/deployment.yaml

Because this template function modifies the secret from the parent chart

` {{- if (not (empty $pullSecrets)) }}
imagePullSecrets:
{{- range $pullSecrets | uniq }}

  • name: {{ . }}
    {{- end }}
    {{- end }}`

For example if your parent chart has

global: imagePullSecrets: - name: regcred

Then this function will give

spec: imagePullSecrets: - name: name: regcred

This is unexpected to me because if I use any other child charts they are not modifying the secret to add the name.
I think this just needs to be fixed with the way it was done in kube-prometheus-stack

https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/templates/_helpers.tpl#L296

What's your helm version?

version.BuildInfo{Version:"v3.15.1", GitCommit:"e211f2aa62992bd72586b395de50979e31231829", GitTreeState:"clean", GoVersion:"go1.22.3"}

What's your kubectl version?

Client Version: v1.30.1

Which chart?

prometheus-elasticsearch-exporter

What's the chart version?

5.8.0

What happened?

Updating prometheus-elasticsearch-exporter from 4.11.0 to 5.8.0 broke my imagepullsecrets

What you expected to happen?

I expect my imagepullsecets to not be modified

How to reproduce it?

Call the prometheus-elasticsearch-exporter chart from a parent chart with the above yaml in the global config.

Enter the changed values of values.yaml?

`global:
imagePullSecrets:

  • name: regcred`

Enter the command that you execute and failing/misfunctioning.

helm template . -f values.yaml --debug

Anything else we need to know?

No response