{{- if .Values.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "mariadb-galera.fullname" . }}-metrics
  labels: {{- include "mariadb-galera.labels" . | nindent 4 }}
  {{- if .Values.metrics.service.annotations }}
  annotations: {{- include "mariadb-galera.tplValue" (dict "value" .Values.metrics.service.annotations "context" $) | nindent 4 }}
  {{- end }}
spec:
  type: {{ .Values.metrics.service.type }}
  ports:
    - name: metrics
      port: {{ .Values.metrics.service.port }}
      targetPort: metrics
  selector: {{- include "mariadb-galera.matchLabels" . | nindent 4 }}
{{- end }}
