From 7cde25bac44714f866a24e9bb3ca8c00e3505ec2 Mon Sep 17 00:00:00 2001 From: Alfred Krohmer Date: Tue, 3 Sep 2019 16:45:35 +0200 Subject: [PATCH] Don't render extraLabels in ServiceMonitor if they are not given This produced invalid YAML before. --- .../victoria-metrics/templates/vminsert-service-monitor.yaml | 2 ++ .../victoria-metrics/templates/vmselect-service-monitor.yaml | 2 ++ .../victoria-metrics/templates/vmstorage-service-monitor.yaml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/deployment/k8s/helm/victoria-metrics/templates/vminsert-service-monitor.yaml b/deployment/k8s/helm/victoria-metrics/templates/vminsert-service-monitor.yaml index 45255ceaee..701612cfc8 100644 --- a/deployment/k8s/helm/victoria-metrics/templates/vminsert-service-monitor.yaml +++ b/deployment/k8s/helm/victoria-metrics/templates/vminsert-service-monitor.yaml @@ -8,7 +8,9 @@ metadata: {{- end }} labels: {{- include "victoria-metrics.vminsert.labels" . | nindent 4 }} + {{- if .Values.vminsert.serviceMonitor.extraLabels }} {{ toYaml .Values.vminsert.serviceMonitor.extraLabels | indent 4 }} + {{- end }} name: {{ template "victoria-metrics.vminsert.fullname" . }} spec: namespaceSelector: diff --git a/deployment/k8s/helm/victoria-metrics/templates/vmselect-service-monitor.yaml b/deployment/k8s/helm/victoria-metrics/templates/vmselect-service-monitor.yaml index c166259c20..04663aa261 100644 --- a/deployment/k8s/helm/victoria-metrics/templates/vmselect-service-monitor.yaml +++ b/deployment/k8s/helm/victoria-metrics/templates/vmselect-service-monitor.yaml @@ -8,7 +8,9 @@ metadata: {{- end }} labels: {{- include "victoria-metrics.vmselect.labels" . | nindent 4 }} + {{- if .Values.vmselect.serviceMonitor.extraLabels }} {{ toYaml .Values.vmselect.serviceMonitor.extraLabels | indent 4 }} + {{- end }} name: {{ template "victoria-metrics.vmselect.fullname" . }} spec: namespaceSelector: diff --git a/deployment/k8s/helm/victoria-metrics/templates/vmstorage-service-monitor.yaml b/deployment/k8s/helm/victoria-metrics/templates/vmstorage-service-monitor.yaml index 70ff763638..e616a848ac 100644 --- a/deployment/k8s/helm/victoria-metrics/templates/vmstorage-service-monitor.yaml +++ b/deployment/k8s/helm/victoria-metrics/templates/vmstorage-service-monitor.yaml @@ -8,7 +8,9 @@ metadata: {{- end }} labels: {{- include "victoria-metrics.vmstorage.labels" . | nindent 4 }} + {{- if .Values.vmstorage.serviceMonitor.extraLabels }} {{ toYaml .Values.vmstorage.serviceMonitor.extraLabels | indent 4 }} + {{- end }} name: {{ template "victoria-metrics.vmstorage.fullname" . }} spec: namespaceSelector: