{{- if .Values.serviceMonitor.enabled }} apiVersion: v1 kind: Service metadata: name: {{ include "external-secrets.fullname" . }}-metrics namespace: {{ .Release.Namespace | quote }} labels: {{- include "external-secrets.selectorLabels" . | nindent 4 }} spec: type: ClusterIP ports: - port: 8080 protocol: TCP name: metrics selector: {{- include "external-secrets.selectorLabels" . | nindent 4 }} --- apiVersion: "monitoring.coreos.com/v1" kind: ServiceMonitor metadata: labels: {{- include "external-secrets.labels" . | nindent 4 }} {{- if .Values.serviceMonitor.additionalLabels }} {{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }} {{- end }} name: {{ include "external-secrets.fullname" . }}-metrics namespace: {{ .Release.Namespace | quote }} spec: selector: matchLabels: {{- include "external-secrets.selectorLabels" . | nindent 6 }} namespaceSelector: matchNames: - {{ .Release.Namespace | quote }} endpoints: - port: metrics interval: {{ .Values.serviceMonitor.interval }} scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} {{- end }}