apiVersion: v1
kind: Service
metadata:
  name: {{ template "elasticsearch.fullname" . }}
  labels:
    app: {{ template "elasticsearch.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
{{- if .Values.service.annotations }}
  annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
spec:
  type: {{ .Values.service.type }}
  ports:
  - name: http
    port: {{ .Values.internalHttpPort }}
    targetPort: {{ .Values.externalHttpPort }}
  - name: transport
    port: {{ .Values.internalTransportPort }}
    targetPort: {{ .Values.externalTransportPort }}
  selector:
    app: {{ template "elasticsearch.name" . }}
    release: {{ .Release.Name }}