From bb82a2ac1f2eceed888dd605cac2a8aa06ed8a84 Mon Sep 17 00:00:00 2001 From: Oleh Neichev Date: Thu, 1 May 2025 11:53:49 +0300 Subject: [PATCH] fix: fix the service monitor label selector This patch does the following: 1. Use "cadvisor.selectorLabels" to select services in the ServiceMonitor 2. Make spacing consistent across templates Signed-off-by: Oleh Neichev --- charts/cadvisor/Chart.yaml | 2 +- charts/cadvisor/templates/clusterrole.yaml | 2 +- charts/cadvisor/templates/clusterrolebinding.yaml | 2 +- charts/cadvisor/templates/daemonset.yaml | 3 +-- charts/cadvisor/templates/servicemonitor.yaml | 3 +-- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/charts/cadvisor/Chart.yaml b/charts/cadvisor/Chart.yaml index cb404bc..6a0a859 100644 --- a/charts/cadvisor/Chart.yaml +++ b/charts/cadvisor/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: A chart for a Cadvisor deployment name: cadvisor -version: 2.4.0 +version: 2.4.1 appVersion: 0.52.1 home: https://github.com/google/cadvisor sources: diff --git a/charts/cadvisor/templates/clusterrole.yaml b/charts/cadvisor/templates/clusterrole.yaml index 34a6b90..8ccbfbb 100644 --- a/charts/cadvisor/templates/clusterrole.yaml +++ b/charts/cadvisor/templates/clusterrole.yaml @@ -12,4 +12,4 @@ rules: verbs: ['use'] resourceNames: - {{ template "cadvisor.name" . }} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/charts/cadvisor/templates/clusterrolebinding.yaml b/charts/cadvisor/templates/clusterrolebinding.yaml index c0dbe37..c74d086 100644 --- a/charts/cadvisor/templates/clusterrolebinding.yaml +++ b/charts/cadvisor/templates/clusterrolebinding.yaml @@ -14,4 +14,4 @@ subjects: - kind: ServiceAccount name: {{ template "cadvisor.serviceAccountName" . }} namespace: {{ .Release.Namespace }} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/charts/cadvisor/templates/daemonset.yaml b/charts/cadvisor/templates/daemonset.yaml index 36dfdb3..96c0602 100644 --- a/charts/cadvisor/templates/daemonset.yaml +++ b/charts/cadvisor/templates/daemonset.yaml @@ -35,7 +35,7 @@ spec: {{- end }} {{- end }} serviceAccountName: {{ template "cadvisor.serviceAccountName" . }} - {{- if .Values.hostNetwork }} + {{- if .Values.hostNetwork }} hostNetwork: true {{- end }} containers: @@ -82,4 +82,3 @@ spec: tolerations: {{ toYaml . | indent 8 }} {{- end }} - diff --git a/charts/cadvisor/templates/servicemonitor.yaml b/charts/cadvisor/templates/servicemonitor.yaml index c848266..e4ba0aa 100644 --- a/charts/cadvisor/templates/servicemonitor.yaml +++ b/charts/cadvisor/templates/servicemonitor.yaml @@ -9,7 +9,7 @@ metadata: spec: selector: matchLabels: - app: {{ template "cadvisor.name" . }} + {{- include "cadvisor.selectorLabels" . | nindent 6 }} namespaceSelector: matchNames: - {{ .Release.Namespace }} @@ -27,4 +27,3 @@ spec: {{- toYaml .Values.metrics.metricRelabelings | nindent 8 }} {{- end -}} {{- end -}} -