apiVersion: v1
kind: Service
metadata:
  name: {{ template "elasticsearch.fullname" . }}
  labels:
    app: {{ template "elasticsearch.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  type: {{ .Values.master.service.type }}
  ports:
    {{ if .Values.master.exposeHttp }}
    - name: http
      port: 9200
      targetPort: http
    {{ end }}
    - name: transport
      port: 9300
      targetPort: transport
  selector:
    app: {{ template "elasticsearch.name" . }}
    release: {{ .Release.Name }}
    component: "{{ .Values.master.name }}"
