--- charts-original/templates/servicemonitor.yaml +++ charts/templates/servicemonitor.yaml @@ -45,9 +45,19 @@ {{- if .Values.prometheus.monitor.honorLabels }} honorLabels: true {{- end }} - {{- if .Values.prometheus.monitor.metricRelabelings }} metricRelabelings: + {{- if .Values.prometheus.monitor.metricRelabelings }} {{- toYaml .Values.prometheus.monitor.metricRelabelings | nindent 8 }} + {{- end }} + {{ if .Values.global.cattle.clusterId }} + - sourceLabels: [__address__] + targetLabel: cluster_id + replacement: {{ .Values.global.cattle.clusterId }} + {{- end }} + {{ if .Values.global.cattle.clusterName }} + - sourceLabels: [__address__] + targetLabel: cluster_name + replacement: {{ .Values.global.cattle.clusterName }} {{- end }} {{- if .Values.prometheus.monitor.relabelings }} relabelings: @@ -81,10 +91,6 @@ {{- if .Values.prometheus.monitor.honorLabels }} honorLabels: true {{- end }} - {{- if .Values.prometheus.monitor.metricRelabelings }} - metricRelabelings: - {{- toYaml .Values.prometheus.monitor.metricRelabelings | nindent 8 }} - {{- end }} {{- if .Values.prometheus.monitor.relabelings }} relabelings: {{- toYaml .Values.prometheus.monitor.relabelings | nindent 8 }}