apiVersion: v1
kind: Service
metadata:
  name: {{ include "serai-base.fullname" . }}
  labels:
    {{- include "serai-base.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    {{- if hasKey .Values.service "ports" }}  
      {{- range .Values.service.ports }}
        - port: {{ .port }}
          name: {{ .name }}
          targetPort: {{ .targetPort }}
          protocol: {{ .protocol }}
      {{- end }}
    {{- else }}
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
    {{- end }}
  selector:
    {{- include "serai-base.selectorLabels" . | nindent 4 }}
