blob: f21401eef7b430eff3ad679c7e66038fb9972d3c [file] [log] [blame]
Andreas Geisslercde4a782024-02-28 16:08:06 +01001{{- /*
2Copyright VMware, Inc.
3SPDX-License-Identifier: APACHE-2.0
4*/}}
5
6{{- if .Values.metrics.enabled }}
7apiVersion: v1
8kind: Service
9metadata:
10 name: {{ printf "%s-metrics" (include "mongodb.fullname" .) }}
11 namespace: {{ include "mongodb.namespace" . | quote }}
12 labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
13 app.kubernetes.io/component: metrics
14 {{- if or .Values.metrics.service.annotations .Values.commonAnnotations }}
15 {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics.service.annotations .Values.commonAnnotations ) "context" . ) }}
16 annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
17 {{- end }}
18spec:
19 type: {{ .Values.metrics.service.type }}
20 ports:
21 - port: {{ .Values.metrics.service.ports.metrics }}
22 targetPort: metrics
23 protocol: TCP
24 name: http-metrics
25 {{- if .Values.metrics.service.extraPorts }}
26 {{- include "common.tplvalues.render" (dict "value" .Values.metrics.service.extraPorts "context" $) | nindent 4 }}
27 {{- end }}
28 {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels ) "context" . ) }}
29 selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
30 app.kubernetes.io/component: mongodb
31{{- end }}