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

[prometheus-blackbox-exporter] include in extra-manifests.yaml #4174

Open
marselsultanov opened this issue Jan 24, 2024 · 4 comments · May be fixed by #5035
Open

[prometheus-blackbox-exporter] include in extra-manifests.yaml #4174

marselsultanov opened this issue Jan 24, 2024 · 4 comments · May be fixed by #5035
Labels
bug Something isn't working

Comments

@marselsultanov
Copy link

marselsultanov commented Jan 24, 2024

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?

  1. 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

@marselsultanov marselsultanov added the bug Something isn't working label Jan 24, 2024
@marselsultanov marselsultanov changed the title [prometheus-blackbox-exporter] extra-manifests.yaml [prometheus-blackbox-exporter] include in extra-manifests.yaml Jan 24, 2024
@marselsultanov
Copy link
Author

marselsultanov commented Jan 24, 2024

If i change:

  1. values.yaml to
extraManifests:
  - |
    apiVersion: v1
    kind: MyCRD
    metadata:
      labels:
        '{{- include "prometheus-blackbox-exporter.labels" . | nindent 4 }}'
  1. extra-manifests.yaml to
{{ range .Values.extraManifests }}
---
{{ tpl . $ }}
{{ end }}

It's work, but i'm not sure that it's a good way...

@Sheikh-Abubaker
Copy link
Contributor

@marselsultanov you can also refer to the similar kind of implementation in loki/production/helm/loki/templates/extra-manifests.yaml

@walker-tom
Copy link
Contributor

@marselsultanov I think you are correct and the solution is as you laid out below.

If i change:

  1. values.yaml to
extraManifests:
  - |
    apiVersion: v1
    kind: MyCRD
    metadata:
      labels:
        '{{- include "prometheus-blackbox-exporter.labels" . | nindent 4 }}'
  1. 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.

@marselsultanov
Copy link
Author

No problem

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
3 participants