# helm_charts_service-headless.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ template "zookeeper.headless" . }}
  labels:
    app: {{ template "zookeeper.name" . }}
    chart: {{ template "zookeeper.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
{{- if .Values.headless.annotations }}
  annotations:
{{ .Values.headless.annotations | toYaml | trimSuffix "\n" | indent 4 }}
{{- end }}
spec:
  clusterIP: None
{{- if .Values.headless.publishNotReadyAddresses }}
  publishNotReadyAddresses: true
{{- end }}
  ports:
{{- range $key, $port := .Values.ports }}
    - name: {{ $key }}
      port: {{ $port.containerPort }}
      targetPort: {{ $key }}
      protocol: {{ $port.protocol }}
{{- end }}
  selector:
    app: {{ template "zookeeper.name" . }}
    release: {{ .Release.Name }}