helm-charts
helm-charts copied to clipboard
[prometheus-blackbox-exporter] include in extra-manifests.yaml
Describe the bug a clear and concise description of what the bug is.
When i put:
extraManifests:
- apiVersion: v1
kind: MyCRD
metadata:
labels:
{{- include "prometheus-blackbox-exporter.labels" . | nindent 4 }}
to: https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus-blackbox-exporter/values.yaml
I get error "did not find expected node content"
Partially case here: https://stackoverflow.com/questions/71169122/how-to-add-custom-templates-to-bitnami-helm-chart but quotas doesn't help me, because i have multiline labels, if i do:
extraManifests:
- apiVersion: v1
kind: MyCRD
metadata:
labels:
'{{- include "prometheus-blackbox-exporter.labels" . | nindent 4 }}'
i get:
metadata:
labels: '
here: default
labels: but_in
single: quote'
but kubectl give error on this :/
How i can use include with map in extraManifests?
What's your helm version?
3.11.1
What's your kubectl version?
1.21
Which chart?
prometheus-blackbox-exporter
What's the chart version?
8.8.0
What happened?
No response
What you expected to happen?
No response
How to reproduce it?
- helm template prometheus-blackbox-exporter prometheus-community/prometheus-blackbox-exporter --values my-values.yaml
my-values.yaml:
extraManifests:
- apiVersion: v1
kind: MyCRD
metadata:
labels:
{{- include "prometheus-blackbox-exporter.labels" . | nindent 4 }}
Enter the changed values of values.yaml?
No response
Enter the command that you execute and failing/misfunctioning.
helm install -f values.yaml
Anything else we need to know?
No response
If i change:
- values.yaml to
extraManifests:
- |
apiVersion: v1
kind: MyCRD
metadata:
labels:
'{{- include "prometheus-blackbox-exporter.labels" . | nindent 4 }}'
- extra-manifests.yaml to
{{ range .Values.extraManifests }}
---
{{ tpl . $ }}
{{ end }}
It's work, but i'm not sure that it's a good way...
@marselsultanov you can also refer to the similar kind of implementation in loki/production/helm/loki/templates/extra-manifests.yaml
@marselsultanov I think you are correct and the solution is as you laid out below.
If i change:
- values.yaml to
extraManifests: - | apiVersion: v1 kind: MyCRD metadata: labels: '{{- include "prometheus-blackbox-exporter.labels" . | nindent 4 }}'
- extra-manifests.yaml to
{{ range .Values.extraManifests }} --- {{ tpl . $ }} {{ end }}
It's work, but i'm not sure that it's a good way...
I did the implementation of extraManifests
for prometheus-blackbox-exporter
in #3167 but have since done an updated implementation for prometheus-snmp-exporter
in #3627 in the way that you described to get around the problem you raised. This same fix was originally done to fix the same problem for prometheus
in #3287 as well.
I am happy to PR the change to fix this if you would like.
No problem