diff --git a/charts/redis-operator/templates/redis-servicemonitor.yaml b/charts/redis-operator/templates/redis-servicemonitor.yaml index 9ba771b..86268f4 100644 --- a/charts/redis-operator/templates/redis-servicemonitor.yaml +++ b/charts/redis-operator/templates/redis-servicemonitor.yaml @@ -1,3 +1,4 @@ +{{ if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" -}} {{- if eq .Values.serviceMonitor true }} --- apiVersion: monitoring.coreos.com/v1 @@ -9,6 +10,9 @@ metadata: app.kubernetes.io/vendor: kubesphere redis-operator: "true" env: production + {{- if .Values.customLabels.serviceMonitor.labels }} + {{- toYaml .Values.customLabels.serviceMonitor.labels | nindent 4 }} + {{- end }} spec: selector: matchLabels: @@ -30,6 +34,9 @@ metadata: app.kubernetes.io/vendor: kubesphere redis-operator: "true" env: production + {{- if .Values.customLabels.serviceMonitor.labels }} + {{- toYaml .Values.customLabels.serviceMonitor.labels | nindent 4 }} + {{- end }} spec: selector: matchLabels: @@ -51,6 +58,9 @@ metadata: app.kubernetes.io/vendor: kubesphere redis-operator: "true" env: production + {{- if .Values.customLabels.serviceMonitor.labels }} + {{- toYaml .Values.customLabels.serviceMonitor.labels | nindent 4 }} + {{- end }} spec: selector: matchLabels: @@ -62,3 +72,4 @@ spec: path: /metrics interval: 10s {{- end }} +{{ end }} \ No newline at end of file diff --git a/charts/redis-operator/values.yaml b/charts/redis-operator/values.yaml index cb80cf2..a95c33c 100644 --- a/charts/redis-operator/values.yaml +++ b/charts/redis-operator/values.yaml @@ -40,3 +40,7 @@ tolerations: [] affinity: {} serviceMonitor: true redisPasswordEncrypt: 0 + +customLabels: + serviceMonitor: + labels: