{{- if .Values.metrics.enabled }} apiVersion: v1 kind: Service metadata: name: {{ template "nextcloud.fullname" . }}-metrics labels: labels: app.kubernetes.io/name: {{ include "nextcloud.name" . }} helm.sh/chart: {{ include "nextcloud.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- if .Values.metrics.service.labels -}} {{ toYaml .Values.metrics.service.labels | nindent 4 }} {{- end -}} {{- if .Values.metrics.service.annotations }} annotations: {{ toYaml .Values.metrics.service.annotations | nindent 4 }} {{- end }} spec: type: {{ .Values.metrics.service.type }} {{ if eq .Values.metrics.service.type "LoadBalancer" -}} {{ if .Values.metrics.service.loadBalancerIP }} loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} {{ end -}} {{- end -}} ports: - name: metrics port: 9205 targetPort: metrics selector: app.kubernetes.io/name: {{ include "nextcloud.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }}