blob: 6f54ed243f367624950285f11aa621cbd4a2ae03 [file] [log] [blame]
Giorgi Lekveishvili8c99d622023-05-30 14:40:50 +04001{{- if and .Values.metrics.enabled (eq .Values.architecture "replication") }}
2apiVersion: v1
3kind: Service
4metadata:
5 name: {{ printf "%s-metrics" (include "postgresql.readReplica.fullname" .) }}
6 namespace: {{ .Release.Namespace | quote }}
7 labels: {{- include "common.labels.standard" . | nindent 4 }}
8 app.kubernetes.io/component: metrics-read
9 {{- if .Values.commonLabels }}
10 {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
11 {{- end }}
12 {{- if or .Values.commonAnnotations .Values.metrics.service.annotations }}
13 annotations:
14 {{- if .Values.commonAnnotations }}
15 {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
16 {{- end }}
17 {{- if .Values.metrics.service.annotations }}
18 {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.service.annotations "context" $ ) | nindent 4 }}
19 {{- end }}
20 {{- end }}
21spec:
22 type: ClusterIP
23 sessionAffinity: {{ .Values.metrics.service.sessionAffinity }}
24 {{- if .Values.metrics.service.clusterIP }}
25 clusterIP: {{ .Values.metrics.service.clusterIP }}
26 {{- end }}
27 ports:
28 - name: http-metrics
29 port: {{ .Values.metrics.service.ports.metrics }}
30 targetPort: http-metrics
31 selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
32 app.kubernetes.io/component: read
33{{- end }}