From 5de98d8c8680e4413e163846fdffdc5ef24e8bf3 Mon Sep 17 00:00:00 2001 From: Jean Mainguy <9969006+jhandguy@users.noreply.github.com> Date: Sun, 21 Jan 2024 22:32:31 +0100 Subject: [PATCH] [kube-prometheus-stack] use name instead of fullname override Signed-off-by: Jean Mainguy <9969006+jhandguy@users.noreply.github.com> --- charts/kube-prometheus-stack/hack/sync_prometheus_rules.py | 2 +- charts/kube-prometheus-stack/templates/_helpers.tpl | 6 +++--- .../prometheus/rules-1.14/k8s.rules.container_resource.yaml | 2 +- .../prometheus/rules-1.14/k8s.rules.pod_owner.yaml | 2 +- .../templates/prometheus/rules-1.14/kube-state-metrics.yaml | 2 +- .../templates/prometheus/rules-1.14/kubernetes-apps.yaml | 2 +- .../prometheus/rules-1.14/kubernetes-resources.yaml | 2 +- .../templates/prometheus/rules-1.14/kubernetes-storage.yaml | 2 +- .../prometheus/rules-1.14/kubernetes-system-kubelet.yaml | 2 +- .../templates/prometheus/rules-1.14/node.rules.yaml | 2 +- .../templates/prometheus/rules-1.14/windows.pod.rules.yaml | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py b/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py index 5df2935da980..a621b3d6c1ce 100755 --- a/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py +++ b/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py @@ -161,7 +161,7 @@ def new_representer(dumper, data): 'init': ''}, 'job="kube-state-metrics"': { 'replacement': 'job="{{ $kubeStateMetricsJob }}"', - 'init': '{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }}'}, + 'init': '{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }}'}, 'job="{{ $kubeStateMetricsJob }}"': { 'replacement': 'job="{{ $kubeStateMetricsJob }}", namespace=~"{{ $targetNamespace }}"', 'limitGroup': ['kubernetes-apps'], diff --git a/charts/kube-prometheus-stack/templates/_helpers.tpl b/charts/kube-prometheus-stack/templates/_helpers.tpl index 257a88d95d24..ce2ad9d02c99 100644 --- a/charts/kube-prometheus-stack/templates/_helpers.tpl +++ b/charts/kube-prometheus-stack/templates/_helpers.tpl @@ -152,9 +152,9 @@ Use the grafana namespace override for multi-namespace deployments in combined c {{/* Allow kube-state-metrics fullname to be overridden */}} -{{- define "kube-prometheus-stack-kube-state-metrics.fullname" -}} - {{- if index .Values "kube-state-metrics" "fullnameOverride" -}} - {{- index .Values "kube-state-metrics" "fullnameOverride" -}} +{{- define "kube-prometheus-stack-kube-state-metrics.name" -}} + {{- if index .Values "kube-state-metrics" "nameOverride" -}} + {{- index .Values "kube-state-metrics" "nameOverride" -}} {{- else -}} {{- print "kube-state-metrics" -}} {{- end -}} diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.container_resource.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.container_resource.yaml index 3c074f81ac03..4cdb7d87fdd2 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.container_resource.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.container_resource.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.k8sContainerResource }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.pod_owner.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.pod_owner.yaml index c9c5f09e2a2b..e06356d4e44b 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.pod_owner.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.pod_owner.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.k8sPodOwner }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kube-state-metrics.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kube-state-metrics.yaml index 61fddbe17e4e..7471bd998343 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kube-state-metrics.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kube-state-metrics.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.kubeStateMetrics }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-apps.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-apps.yaml index af4f65b6c5d5..48845fe7bc35 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-apps.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-apps.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.kubernetesApps }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} {{- $targetNamespace := .Values.defaultRules.appNamespacesTarget }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-resources.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-resources.yaml index f02531609968..f0e49dc3b131 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-resources.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-resources.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.kubernetesResources }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-storage.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-storage.yaml index dafc390d89db..1927c7ad4ea1 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-storage.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-storage.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.kubernetesStorage }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} {{- $targetNamespace := .Values.defaultRules.appNamespacesTarget }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-system-kubelet.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-system-kubelet.yaml index a378e72703ca..75efdd647171 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-system-kubelet.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-system-kubelet.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.kubernetesSystem }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node.rules.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node.rules.yaml index ed325ebb310d..71c246d685bf 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node.rules.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node.rules.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.node }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: diff --git a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/windows.pod.rules.yaml b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/windows.pod.rules.yaml index 127a785c987f..86340b5c0573 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/windows.pod.rules.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/windows.pod.rules.yaml @@ -5,7 +5,7 @@ https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-promet */ -}} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.windowsMonitoring.enabled .Values.defaultRules.rules.windows }} -{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.fullname" . }} +{{- $kubeStateMetricsJob := include "kube-prometheus-stack-kube-state-metrics.name" . }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: