svc-headless.yaml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  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"
  25. spec:
  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