Don't render extraLabels in ServiceMonitor if they are not given

This produced invalid YAML before.
This commit is contained in:
Alfred Krohmer 2019-09-03 16:45:35 +02:00 committed by Artem Navoiev
parent 3182e2a66b
commit 7cde25bac4
3 changed files with 6 additions and 0 deletions

View file

@ -8,7 +8,9 @@ metadata:
{{- end }} {{- end }}
labels: labels:
{{- include "victoria-metrics.vminsert.labels" . | nindent 4 }} {{- include "victoria-metrics.vminsert.labels" . | nindent 4 }}
{{- if .Values.vminsert.serviceMonitor.extraLabels }}
{{ toYaml .Values.vminsert.serviceMonitor.extraLabels | indent 4 }} {{ toYaml .Values.vminsert.serviceMonitor.extraLabels | indent 4 }}
{{- end }}
name: {{ template "victoria-metrics.vminsert.fullname" . }} name: {{ template "victoria-metrics.vminsert.fullname" . }}
spec: spec:
namespaceSelector: namespaceSelector:

View file

@ -8,7 +8,9 @@ metadata:
{{- end }} {{- end }}
labels: labels:
{{- include "victoria-metrics.vmselect.labels" . | nindent 4 }} {{- include "victoria-metrics.vmselect.labels" . | nindent 4 }}
{{- if .Values.vmselect.serviceMonitor.extraLabels }}
{{ toYaml .Values.vmselect.serviceMonitor.extraLabels | indent 4 }} {{ toYaml .Values.vmselect.serviceMonitor.extraLabels | indent 4 }}
{{- end }}
name: {{ template "victoria-metrics.vmselect.fullname" . }} name: {{ template "victoria-metrics.vmselect.fullname" . }}
spec: spec:
namespaceSelector: namespaceSelector:

View file

@ -8,7 +8,9 @@ metadata:
{{- end }} {{- end }}
labels: labels:
{{- include "victoria-metrics.vmstorage.labels" . | nindent 4 }} {{- include "victoria-metrics.vmstorage.labels" . | nindent 4 }}
{{- if .Values.vmstorage.serviceMonitor.extraLabels }}
{{ toYaml .Values.vmstorage.serviceMonitor.extraLabels | indent 4 }} {{ toYaml .Values.vmstorage.serviceMonitor.extraLabels | indent 4 }}
{{- end }}
name: {{ template "victoria-metrics.vmstorage.fullname" . }} name: {{ template "victoria-metrics.vmstorage.fullname" . }}
spec: spec:
namespaceSelector: namespaceSelector: