blob: 684177a5cd5c52d1c14ac7673d1d7f735329b6c4 [file] [log] [blame]
Giorgi Lekveishvili8c99d622023-05-30 14:40:50 +04001apiVersion: v1
2kind: Service
3metadata:
4 name: {{ include "postgresql.primary.svc.headless" . }}
5 namespace: {{ .Release.Namespace | quote }}
6 labels: {{- include "common.labels.standard" . | nindent 4 }}
7 {{- if .Values.commonLabels }}
8 {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
9 {{- end }}
10 app.kubernetes.io/component: primary
11 {{- if or .Values.primary.service.headless.annotations .Values.commonAnnotations }}
12 annotations:
13 {{- if .Values.primary.service.headless.annotations }}
14 {{- include "common.tplvalues.render" ( dict "value" .Values.primary.service.headless.annotations "context" $ ) | nindent 4 }}
15 {{- end }}
16 {{- if .Values.commonAnnotations }}
17 {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
18 {{- end }}
19 {{- end }}
20 # Use this annotation in addition to the actual publishNotReadyAddresses
21 # field below because the annotation will stop being respected soon but the
22 # field is broken in some versions of Kubernetes:
23 # https://github.com/kubernetes/kubernetes/issues/58662
24 service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
25spec:
26 type: ClusterIP
27 clusterIP: None
28 # We want all pods in the StatefulSet to have their addresses published for
29 # the sake of the other Postgresql pods even before they're ready, since they
30 # have to be able to talk to each other in order to become ready.
31 publishNotReadyAddresses: true
32 ports:
33 - name: tcp-postgresql
34 port: {{ template "postgresql.service.port" . }}
35 targetPort: tcp-postgresql
36 selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
37 app.kubernetes.io/component: primary