diff --git a/chart/mongodb-query-exporter/Chart.yaml b/chart/mongodb-query-exporter/Chart.yaml index a8fef82d..2407220a 100644 --- a/chart/mongodb-query-exporter/Chart.yaml +++ b/chart/mongodb-query-exporter/Chart.yaml @@ -15,4 +15,4 @@ keywords: name: mongodb-query-exporter sources: - https://github.com/raffis/mongodb-query-exporter -version: 4.0.0 +version: 4.0.1 diff --git a/chart/mongodb-query-exporter/templates/_helpers.tpl b/chart/mongodb-query-exporter/templates/_helpers.tpl index ab6c21fe..5aa48a7d 100644 --- a/chart/mongodb-query-exporter/templates/_helpers.tpl +++ b/chart/mongodb-query-exporter/templates/_helpers.tpl @@ -68,13 +68,14 @@ Determine configmap name, can either be the self-created of an existing one {{/* Common labels */}} -{{- define "mongodb-query-exporter.labels" -}}{{- if .Values.chartLabels }} - app.kubernetes.io/name: {{ include "mongodb-query-exporter.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "mongodb-query-exporter.chart" . }} +{{- define "mongodb-query-exporter.labels" -}} +{{ if .Values.chartLabels -}} +app.kubernetes.io/name: {{ include "mongodb-query-exporter.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +helm.sh/chart: {{ include "mongodb-query-exporter.chart" . }} {{- end -}} -{{- with .Values.labels }} - {{ . | toYaml }} +{{ if .Values.labels }} +{{ toYaml .Values.labels }} {{- end -}} {{- end -}} diff --git a/chart/mongodb-query-exporter/templates/configmap.yaml b/chart/mongodb-query-exporter/templates/configmap.yaml index 3948da1f..6672bdfe 100644 --- a/chart/mongodb-query-exporter/templates/configmap.yaml +++ b/chart/mongodb-query-exporter/templates/configmap.yaml @@ -3,10 +3,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "mongodb-query-exporter.configName" . }} - {{- with ( include "mongodb-query-exporter.labels" . ) }} - labels: - {{- . }} - {{- end }} + labels: {{- include "mongodb-query-exporter.labels" . | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/chart/mongodb-query-exporter/templates/deployment.yaml b/chart/mongodb-query-exporter/templates/deployment.yaml index 5e0566e5..ff0d3fbb 100644 --- a/chart/mongodb-query-exporter/templates/deployment.yaml +++ b/chart/mongodb-query-exporter/templates/deployment.yaml @@ -2,10 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "mongodb-query-exporter.fullname" . }} - {{- with ( include "mongodb-query-exporter.labels" . ) }} - labels: - {{- . }} - {{- end }} + labels: {{- include "mongodb-query-exporter.labels" . | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/chart/mongodb-query-exporter/templates/podmonitor.yaml b/chart/mongodb-query-exporter/templates/podmonitor.yaml index 653dee18..e94260ba 100644 --- a/chart/mongodb-query-exporter/templates/podmonitor.yaml +++ b/chart/mongodb-query-exporter/templates/podmonitor.yaml @@ -3,11 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ include "mongodb-query-exporter.fullname" . }} - {{- $labels := merge ( include "mongodb-query-exporter.labels" . | fromYaml) .Values.podMonitor.labels -}} - {{- with $labels }} - labels: - {{- toYaml . | nindent 4 }} - {{- end }} + labels: {{- merge ( include "mongodb-query-exporter.labels" . | fromYaml) .Values.podMonitor.labels | toYaml | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/chart/mongodb-query-exporter/templates/prometheusrule.yaml b/chart/mongodb-query-exporter/templates/prometheusrule.yaml index b3ba1cd0..7607bee4 100644 --- a/chart/mongodb-query-exporter/templates/prometheusrule.yaml +++ b/chart/mongodb-query-exporter/templates/prometheusrule.yaml @@ -4,11 +4,7 @@ kind: PrometheusRule metadata: metadata: name: {{ template "mongodb-query-exporter.fullname" . }} - {{- $labels := merge ( include "mongodb-query-exporter.labels" . | fromYaml) .Values.prometheusRule.labels -}} - {{- with $labels }} - labels: - {{- toYaml . | nindent 4 }} - {{- end }} + labels: {{- merge ( include "mongodb-query-exporter.labels" . | fromYaml) .Values.prometheusRule.labels | toYaml | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/chart/mongodb-query-exporter/templates/secret.yaml b/chart/mongodb-query-exporter/templates/secret.yaml index c3c7c3f7..c2fc271b 100644 --- a/chart/mongodb-query-exporter/templates/secret.yaml +++ b/chart/mongodb-query-exporter/templates/secret.yaml @@ -3,10 +3,7 @@ apiVersion: v1 kind: Secret metadata: name: {{ include "mongodb-query-exporter.secretName" . }} - {{- with ( include "mongodb-query-exporter.labels" . ) }} - labels: - {{- . }} - {{- end }} + labels: {{- include "mongodb-query-exporter.labels" . | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/chart/mongodb-query-exporter/templates/service.yaml b/chart/mongodb-query-exporter/templates/service.yaml index 72dd795d..19aba948 100644 --- a/chart/mongodb-query-exporter/templates/service.yaml +++ b/chart/mongodb-query-exporter/templates/service.yaml @@ -3,11 +3,7 @@ apiVersion: v1 kind: Service metadata: name: {{ include "mongodb-query-exporter.fullname" . }} - {{- $labels := merge ( include "mongodb-query-exporter.labels" . | fromYaml) .Values.service.labels -}} - {{- with $labels }} - labels: - {{- toYaml . | nindent 4 }} - {{- end }} + labels: {{- merge ( include "mongodb-query-exporter.labels" . | fromYaml) .Values.service.labels | toYaml | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/chart/mongodb-query-exporter/templates/serviceaccount.yaml b/chart/mongodb-query-exporter/templates/serviceaccount.yaml index 5f1feaca..879a3f55 100644 --- a/chart/mongodb-query-exporter/templates/serviceaccount.yaml +++ b/chart/mongodb-query-exporter/templates/serviceaccount.yaml @@ -3,10 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "mongodb-query-exporter.serviceAccountName" . }} - {{- with ( include "mongodb-query-exporter.labels" . ) }} - labels: - {{- . }} - {{- end }} + labels: {{- include "mongodb-query-exporter.labels" . | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/chart/mongodb-query-exporter/templates/servicemonitor.yaml b/chart/mongodb-query-exporter/templates/servicemonitor.yaml index 59ade4fc..6c6c8b95 100644 --- a/chart/mongodb-query-exporter/templates/servicemonitor.yaml +++ b/chart/mongodb-query-exporter/templates/servicemonitor.yaml @@ -3,11 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "mongodb-query-exporter.fullname" . }} - {{- $labels := merge ( include "mongodb-query-exporter.labels" . | fromYaml) .Values.serviceMonitor.labels -}} - {{- with $labels }} - labels: - {{- toYaml . | nindent 4 }} - {{- end }} + labels: {{- merge ( include "mongodb-query-exporter.labels" . | fromYaml) .Values.serviceMonitor.labels | toYaml | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }}