apiVersion: v1
kind: Service
metadata:
  name: {{ include "kafka.fullname" . }}-headless
  labels:
  {{- include "kafka.broker.labels" . | nindent 4 }}
  annotations:
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
{{- if .Values.headless.annotations }}
{{ .Values.headless.annotations | toYaml | trimSuffix "\n" | indent 4 }}
{{- end }}
spec:
  ports:
  - name: broker
    port: {{ .Values.headless.port }}
{{- if .Values.headless.targetPort }}
    targetPort: {{ .Values.headless.targetPort }}
{{- end }}
  clusterIP: None
  selector:
  {{- include "kafka.broker.matchLabels" . | nindent 4 }}
