diff --git a/charts/kube-prometheus-stack/Chart.yaml b/charts/kube-prometheus-stack/Chart.yaml index ac06103719f4..da4424caeb20 100644 --- a/charts/kube-prometheus-stack/Chart.yaml +++ b/charts/kube-prometheus-stack/Chart.yaml @@ -21,7 +21,7 @@ name: kube-prometheus-stack sources: - https://github.com/prometheus-community/helm-charts - https://github.com/prometheus-operator/kube-prometheus -version: 46.4.2 +version: 46.5.0 appVersion: v0.65.1 kubeVersion: ">=1.16.0-0" home: https://github.com/prometheus-operator/kube-prometheus diff --git a/charts/kube-prometheus-stack/templates/alertmanager/alertmanager.yaml b/charts/kube-prometheus-stack/templates/alertmanager/alertmanager.yaml index 4786af0f3c25..7eaff9fa0729 100644 --- a/charts/kube-prometheus-stack/templates/alertmanager/alertmanager.yaml +++ b/charts/kube-prometheus-stack/templates/alertmanager/alertmanager.yaml @@ -59,13 +59,13 @@ spec: {{- end }} {{- if .Values.alertmanager.alertmanagerSpec.alertmanagerConfigSelector }} alertmanagerConfigSelector: -{{ toYaml .Values.alertmanager.alertmanagerSpec.alertmanagerConfigSelector | indent 4}} +{{ tpl (toYaml .Values.alertmanager.alertmanagerSpec.alertmanagerConfigSelector | indent 4) . }} {{ else }} alertmanagerConfigSelector: {} {{- end }} {{- if .Values.alertmanager.alertmanagerSpec.alertmanagerConfigNamespaceSelector }} alertmanagerConfigNamespaceSelector: -{{ toYaml .Values.alertmanager.alertmanagerSpec.alertmanagerConfigNamespaceSelector | indent 4}} +{{ tpl (toYaml .Values.alertmanager.alertmanagerSpec.alertmanagerConfigNamespaceSelector | indent 4) . }} {{ else }} alertmanagerConfigNamespaceSelector: {} {{- end }} diff --git a/charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml b/charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml index de08ae89b09e..47e709f869c6 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml @@ -146,7 +146,7 @@ spec: serviceAccountName: {{ template "kube-prometheus-stack.prometheus.serviceAccountName" . }} {{- if .Values.prometheus.prometheusSpec.serviceMonitorSelector }} serviceMonitorSelector: -{{ toYaml .Values.prometheus.prometheusSpec.serviceMonitorSelector | indent 4 }} +{{ tpl (toYaml .Values.prometheus.prometheusSpec.serviceMonitorSelector | indent 4) . }} {{ else if .Values.prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues }} serviceMonitorSelector: matchLabels: @@ -156,13 +156,13 @@ spec: {{- end }} {{- if .Values.prometheus.prometheusSpec.serviceMonitorNamespaceSelector }} serviceMonitorNamespaceSelector: -{{ toYaml .Values.prometheus.prometheusSpec.serviceMonitorNamespaceSelector | indent 4 }} +{{ tpl (toYaml .Values.prometheus.prometheusSpec.serviceMonitorNamespaceSelector | indent 4) . }} {{ else }} serviceMonitorNamespaceSelector: {} {{- end }} {{- if .Values.prometheus.prometheusSpec.podMonitorSelector }} podMonitorSelector: -{{ toYaml .Values.prometheus.prometheusSpec.podMonitorSelector | indent 4 }} +{{ tpl (toYaml .Values.prometheus.prometheusSpec.podMonitorSelector | indent 4) . }} {{ else if .Values.prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues }} podMonitorSelector: matchLabels: @@ -172,13 +172,13 @@ spec: {{- end }} {{- if .Values.prometheus.prometheusSpec.podMonitorNamespaceSelector }} podMonitorNamespaceSelector: -{{ toYaml .Values.prometheus.prometheusSpec.podMonitorNamespaceSelector | indent 4 }} +{{ tpl (toYaml .Values.prometheus.prometheusSpec.podMonitorNamespaceSelector | indent 4) . }} {{ else }} podMonitorNamespaceSelector: {} {{- end }} {{- if .Values.prometheus.prometheusSpec.probeSelector }} probeSelector: -{{ toYaml .Values.prometheus.prometheusSpec.probeSelector | indent 4 }} +{{ tpl (toYaml .Values.prometheus.prometheusSpec.probeSelector | indent 4) . }} {{ else if .Values.prometheus.prometheusSpec.probeSelectorNilUsesHelmValues }} probeSelector: matchLabels: @@ -188,7 +188,7 @@ spec: {{- end }} {{- if .Values.prometheus.prometheusSpec.probeNamespaceSelector }} probeNamespaceSelector: -{{ toYaml .Values.prometheus.prometheusSpec.probeNamespaceSelector | indent 4 }} +{{ tpl (toYaml .Values.prometheus.prometheusSpec.probeNamespaceSelector | indent 4) . }} {{ else }} probeNamespaceSelector: {} {{- end }} @@ -216,14 +216,14 @@ spec: {{- end }} {{- if .Values.prometheus.prometheusSpec.ruleNamespaceSelector }} ruleNamespaceSelector: -{{ toYaml .Values.prometheus.prometheusSpec.ruleNamespaceSelector | indent 4 }} +{{ tpl (toYaml .Values.prometheus.prometheusSpec.ruleNamespaceSelector | indent 4) . }} {{ else }} ruleNamespaceSelector: {} {{- end }} {{- if not (has "agent" .Values.prometheus.prometheusSpec.enableFeatures) }} {{- if .Values.prometheus.prometheusSpec.ruleSelector }} ruleSelector: -{{ toYaml .Values.prometheus.prometheusSpec.ruleSelector | indent 4}} +{{ tpl (toYaml .Values.prometheus.prometheusSpec.ruleSelector | indent 4) . }} {{- else if .Values.prometheus.prometheusSpec.ruleSelectorNilUsesHelmValues }} ruleSelector: matchLabels: @@ -232,6 +232,22 @@ spec: ruleSelector: {} {{- end }} {{- end }} +{{- if .Values.prometheus.prometheusSpec.scrapeConfigSelector }} + scrapeConfigSelector: +{{ tpl (toYaml .Values.prometheus.prometheusSpec.scrapeConfigSelector | indent 4) . }} +{{ else if .Values.prometheus.prometheusSpec.scrapeConfigSelectorNilUsesHelmValues }} + scrapeConfigSelector: + matchLabels: + release: {{ $.Release.Name | quote }} +{{ else }} + scrapeConfigSelector: {} +{{- end }} +{{- if .Values.prometheus.prometheusSpec.scrapeConfigNamespaceSelector }} + scrapeConfigNamespaceSelector: +{{ tpl (toYaml .Values.prometheus.prometheusSpec.scrapeConfigNamespaceSelector | indent 4) . }} +{{ else }} + scrapeConfigNamespaceSelector: {} +{{- end }} {{- if .Values.prometheus.prometheusSpec.storageSpec }} storage: {{ tpl (toYaml .Values.prometheus.prometheusSpec.storageSpec | indent 4) . }} diff --git a/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml b/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml index cf678b5448ad..505d68b025d8 100644 --- a/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml +++ b/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml @@ -50,13 +50,13 @@ spec: {{- end }} {{- if .Values.thanosRuler.thanosRulerSpec.ruleNamespaceSelector }} ruleNamespaceSelector: -{{ toYaml .Values.thanosRuler.thanosRulerSpec.ruleNamespaceSelector | indent 4 }} +{{ tpl (toYaml .Values.thanosRuler.thanosRulerSpec.ruleNamespaceSelector | indent 4) . }} {{ else }} ruleNamespaceSelector: {} {{- end }} {{- if .Values.thanosRuler.thanosRulerSpec.ruleSelector }} ruleSelector: -{{ toYaml .Values.thanosRuler.thanosRulerSpec.ruleSelector | indent 4}} +{{ tpl (toYaml .Values.thanosRuler.thanosRulerSpec.ruleSelector | indent 4) .}} {{- else if .Values.thanosRuler.thanosRulerSpec.ruleSelectorNilUsesHelmValues }} ruleSelector: matchLabels: diff --git a/charts/kube-prometheus-stack/values.yaml b/charts/kube-prometheus-stack/values.yaml index 231809130ead..7018316ee553 100644 --- a/charts/kube-prometheus-stack/values.yaml +++ b/charts/kube-prometheus-stack/values.yaml @@ -3028,6 +3028,28 @@ prometheus: # matchLabels: # prometheus: somelabel + ## If true, a nil or {} value for prometheus.prometheusSpec.scrapeConfigSelector will cause the + ## prometheus resource to be created with selectors based on values in the helm deployment, + ## which will also match the scrapeConfigs created + ## + scrapeConfigSelectorNilUsesHelmValues: true + + ## scrapeConfigs to be selected for target discovery. + ## If {}, select all scrapeConfigs + ## + scrapeConfigSelector: {} + ## Example which selects scrapeConfigs with label "prometheus" set to "somelabel" + # scrapeConfig: + # matchLabels: + # prometheus: somelabel + + ## If nil, select own namespace. Namespaces to be selected for scrapeConfig discovery. + scrapeConfigNamespaceSelector: {} + ## Example which selects scrapeConfig in namespaces with label "prometheus" set to "somelabel" + # scrapeConfigsNamespaceSelector: + # matchLabels: + # prometheus: somelabel + ## How long to retain metrics ## retention: 10d