---
{{- if or .Values.service.enabled .Values.ingress.enabled }}
apiVersion: "v1"
kind: "Service"
metadata:
  name: {{ include "common.names.fullname" . }}
  labels:
    {{- include "common.labels.standard" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  {{- if .Values.service.sessionAffinity.enabled }}
  sessionAffinity: "ClientIP"
  sessionAffinityConfig:
    clientIP:
      timeoutSeconds: {{ .Values.service.sessionAffinity.timeoutSeconds }}
  {{- end }}
  ports:
    {{- range $key, $value := .Values.service.ports }}
    - port: {{ $value.port }}
      targetPort: {{ $key }}
      protocol: {{ $value.protocol }}
      name: {{ $key }}
      {{- if and (eq $.Values.service.type "NodePort") $value.nodePort }}
      nodePort: {{ $value.nodePort }}
      {{- end }}
    {{- end }}
  selector:
    {{- include "common.labels.matchLabels" . | nindent 4 }}
    openproject/process: web
{{- end }}
...
