apiVersion: v1
kind: Service
metadata:
  name: {{ template "zeppelin.fullname" . }}
  labels:
    app: {{ template "zeppelin.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  annotations:
  {{- if .Values.service.annotations }}
{{ toYaml .Values.service.annotations | indent 4 }}
  {{- end }}
spec:
  type: {{ .Values.service.type }}
  ports:
  - port: 8080
    name: web
    targetPort: 8080
    {{- if .Values.service.nodePort }}
    nodePort:  {{ .Values.service.nodePort }}
    {{- end }}
  selector:
    app: {{ template "zeppelin.name" . }}
    release: {{ .Release.Name }}
{{- if contains "LoadBalancer" .Values.service.type }}
  {{- if .Values.service.loadBalancerIP }}
  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
  {{- end -}}
  {{- if .Values.service.loadBalancerSourceRanges}}
  loadBalancerSourceRanges:
  {{- range .Values.service.loadBalancerSourceRanges }}
  - {{ . }}
  {{- end }}
  {{- end -}}
{{- end -}}
