{{- if .Values.metrics.service.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "external-secrets.fullname" . }}-metrics
  namespace: {{ .Release.Namespace | quote }}
  labels:
    {{- include "external-secrets.labels" . | nindent 4 }}
  {{- with .Values.metrics.service.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  type: ClusterIP
  ports:
    - port: {{ .Values.metrics.service.port }}
      protocol: TCP
      targetPort: metrics
      name: metrics
  selector:
    {{- include "external-secrets.selectorLabels" . | nindent 4 }}
{{- end }}
