Skip to content

Commit

Permalink
[kube-prometheus-stack] Implement POC basing on @jkroepke's suggestio…
Browse files Browse the repository at this point in the history
…n in #4818

Signed-off-by: Johannes Schnatterer <johannes.schnatterer@cloudogu.com>
  • Loading branch information
schnatterer committed Aug 28, 2024
1 parent 7157047 commit 739fe4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
16 changes: 2 additions & 14 deletions charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -246,21 +246,9 @@ spec:
ruleSelector: {}
{{- end }}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.scrapeConfigSelector }}
{{- if not (eq .Values.prometheus.prometheusSpec.scrapeConfigSelector nil)}}
scrapeConfigSelector:
{{ tpl (toYaml .Values.prometheus.prometheusSpec.scrapeConfigSelector | indent 4) . }}
{{ else if .Values.prometheus.prometheusSpec.scrapeConfigSelectorNilUsesHelmValues }}
scrapeConfigSelector:
matchLabels:
release: {{ $.Release.Name | quote }}
{{ else if not (eq .Values.prometheus.prometheusSpec.scrapeConfigSelector nil) }}
scrapeConfigSelector: {}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.scrapeConfigNamespaceSelector }}
scrapeConfigNamespaceSelector:
{{ tpl (toYaml .Values.prometheus.prometheusSpec.scrapeConfigNamespaceSelector | indent 4) . }}
{{ else if not (eq .Values.prometheus.prometheusSpec.scrapeConfigNamespaceSelector nil) }}
scrapeConfigNamespaceSelector: {}
{{- tpl (toYaml .Values.prometheus.prometheusSpec.scrapeConfigSelector | indent 4) . | nindent 2 }}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.storageSpec }}
storage:
Expand Down
4 changes: 3 additions & 1 deletion charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3692,7 +3692,9 @@ prometheus:
## scrapeConfigs to be selected for target discovery.
## If {}, select all scrapeConfigs
##
scrapeConfigSelector: {}
scrapeConfigSelector:
matchLabels:
release: "{{ $.Release.Name }}"
## Example which selects scrapeConfigs with label "prometheus" set to "somelabel"
# scrapeConfigSelector:
# matchLabels:
Expand Down

0 comments on commit 739fe4c

Please sign in to comment.