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