apiVersion: v1
kind: Service
metadata:
  name: {{ include "pipelines.www.name" . }}
  labels:
    {{- include "pipelines.labels" . | nindent 4 }}
    component: {{ include "pipelines.www.name" . }}
{{- if .Values.pipelines.www.service.annotations }}
  annotations:
    {{- range $key, $value := .Values.pipelines.www.service.annotations }}
      {{ $key }}: {{ $value | quote }}
    {{- end }}
{{- end }}
spec:
  type: {{ .Values.pipelines.www.service.type }}
{{- if .Values.pipelines.www.service.loadBalancerIP }}
  loadBalancerIP: {{ .Values.pipelines.www.service.loadBalancerIP }}
 {{- end }}
{{- if .Values.pipelines.www.service.loadBalancerSourceRanges }}
  loadBalancerSourceRanges:
{{ toYaml .Values.pipelines.www.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
  ports:
    - port: {{ .Values.pipelines.www.service.port }}
{{- if eq .Values.pipelines.www.service.type "NodePort" }}
      nodePort: 30001
{{- end }}
      targetPort: 30001
      protocol: TCP
      name: www
  selector:
    {{- include "pipelines.selectorLabels" . | nindent 4 }}
    component: {{ include "pipelines.services.name" . }}
