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] Add extra manifest templates #2140

Merged

Conversation

katsew
Copy link
Contributor

@katsew katsew commented Jun 10, 2022

Signed-off-by: Yu Kato yu-kato@colopl.co.jp

What this PR does / why we need it:

This PR offers to deploy extra manifests, which includes any template inside prometheus helper.
When we want to deploy extra manifests using template helper the chart provides,
server.extraObjects does not help in some cases.

Which issue this PR fixes

fixes #2139

Special notes for your reviewer:

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

Resolves: prometheus-community#2139

Signed-off-by: Yu Kato <yu-kato@colopl.co.jp>
@zanhsieh zanhsieh merged commit 70e00b9 into prometheus-community:main Jun 11, 2022
@katsew katsew deleted the prometheus-server-extra-templates branch June 13, 2022 01:23
@jean-pierre-schoeman
Copy link

@zanhsieh Have a question about the functionality in this PR
The original block in the extra-manifests.yaml was added in this PR 2044

This PR 2140 then extended on it with template based variation

PR 2294 then did exactly the same functionality as 2044 while removing the functionality of this PR 2140

Was this an intentional decision to remove the functionality?
If so, what was the rational behind the removal?

@monotek
Copy link
Member

monotek commented Feb 2, 2023

See: https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus/README.md#to-190

@jean-pierre-schoeman
Copy link

jean-pierre-schoeman commented Feb 2, 2023

@monotek That was the expectation, However we are not able to get template from previous changes to work on the new variation
I suspect that it could be ignorance from my side

Would you be able to provide additional guidance on how to get this to work with new mechanism or point in a direction on how to get this working

Help would be appreciated

extraTemplates:
   - |
     apiVersion: v1
     kind: ConfigMap
     metadata:
       name: extra-config
       labels:
       {{- include "prometheus.server.labels" . | nindent 4 }}
     data:
     {{ ( tpl (.Files.Glob "rules/**/*.yaml").AsConfig .) | indent 2 }}`

The files being loaded in basic form look as follows

groups:
- name: SomeRule
  rules:
  - alert: "SomeAlert"
    expr: some_metric
    for: 3m
    labels:
      priority: P1
      service: "some_service"
      severity: High
    annotations:
      runBook: "https://somelink"
      summary: "extra Info"

Edit: code block is not rendering indentation properly

@monotek
Copy link
Member

monotek commented Feb 2, 2023

You have to use "```" for codeblocks.

Current value shuld be "extraManifests" not "extraTemplates".

@jean-pierre-schoeman
Copy link

jean-pierre-schoeman commented Feb 2, 2023

@monotek Please ignore the value name, it was an excerpt from current implementation on our side
This does not work due to toYaml function being executed before the tpl

   - apiVersion: v1
     kind: ConfigMap
     metadata:
       name: extra-config
       labels:
       {{- include "prometheus.server.labels" . | nindent 4 }}
     data:
     {{ ( tpl (.Files.Glob "rules/**/*.yaml").AsConfig .) | indent 2 }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[prometheus] Accept template string as server.extraObjects
4 participants