apiVersion: v1
kind: Service
metadata:
  name: {{ template "zookeeper.fullname" . }}
  labels:
    app: {{ template "zookeeper.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      protocol: TCP
      name: {{ .Values.service.name }}
  selector:
    app: {{ template "zookeeper.name" . }}
    release: {{ .Release.Name }}

---

apiVersion: v1
kind: Service
metadata:
  name: {{ template "zookeeper.fullname" . }}-headless
  labels:
    app: {{ template "zookeeper.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  clusterIP: None
  ports:
    - port: 2181
      name: clients
    - port: 2888
      name: server
    - port: 3888
      name: leader-election
  selector:
    app: {{ template "zookeeper.name" . }}
    release: {{ .Release.Name }}
