{{- if .Values.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "vals-operator.fullname" . }} labels: {{- if .Values.serviceMonitor.labels }} {{ toYaml .Values.serviceMonitor.labels | nindent 4 }} {{- else }} app: {{ template "vals-operator.name" . }} chart: {{ template "vals-operator.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- end }} {{- if .Values.serviceMonitor.namespace }} namespace: {{ .Values.serviceMonitor.namespace }} {{- end }} spec: endpoints: - targetPort: "metrics" {{- if .Values.serviceMonitor.interval }} interval: {{ .Values.serviceMonitor.interval }} {{- end }} {{- if .Values.serviceMonitor.scrapeTimeout }} scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} {{- end }} path: /metrics port: {{ .Values.metricsPort | default 8080 }} tlsConfig: insecureSkipVerify: true namespaceSelector: matchNames: - {{ .Release.Namespace }} selector: matchLabels: {{- include "vals-operator.selectorLabels" . | nindent 6 }} {{- end }}