svc-headless.yaml 1.8 KB

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