svc-headless.yaml 1.9 KB

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