apiVersion: v1
kind: Service
metadata:
  name: {{ template "fullname" . }}
{{- if .Values.service.annotations }}
  annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
  labels:
    app: {{ template "fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
spec:
  type: {{ .Values.service.type }}
  ports:
  - name: http
    port: {{ .Values.service.servicePort }}
    targetPort: 3000
    protocol: TCP
    {{- if eq .Values.service.type "NodePort" }}
    nodePort: {{ .Values.service.nodePort.port }}
    {{- end }}
  selector:
    app: {{ template "fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
