VictoriaMetrics/deployment/k8s/helm/victoria-metrics/templates/vmselect-service-monitor.yaml
Alfred Krohmer 7cde25bac4 Don't render extraLabels in ServiceMonitor if they are not given
This produced invalid YAML before.
2019-09-03 22:11:24 +03:00

31 lines
1.1 KiB
YAML

{{- if and .Values.vmselect.enabled .Values.vmselect.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- if .Values.vmselect.serviceMonitor.annotations }}
annotations:
{{ toYaml .Values.vmselect.serviceMonitor.annotations | indent 4 }}
{{- 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:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "victoria-metrics.vmselect.matchLabels" . | nindent 6 }}
endpoints:
- port: http
{{- if .Values.vmselect.serviceMonitor.interval }}
interval: {{ .Values.vmselect.serviceMonitor.interval }}
{{- end }}
{{- if .Values.vmselect.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.vmselect.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- end }}