{{- $enabled := eq (include "osdu-developer-service.isEnabled" .) "1" -}}
{{- $serviceType := .Values.service.type }}
{{- $servicePort := .Values.service.port }}
{{- $targetPort := .Values.service.target }}
{{- $labels := include "osdu-developer-service.labels" . | nindent 4 }}
{{- $selectorLabels := include "osdu-developer-service.selectorLabels" . | nindent 4 }}
{{- range .Values.configuration }}
{{- if and $enabled .service }}
---
apiVersion: v1
kind: Service
metadata:
  name: {{ .service }}
  labels: {{ $labels }}
    app: {{ .service }}
spec:
  type: {{ $serviceType }}
  ports:
    - port: {{ $servicePort }}
      targetPort: {{ $targetPort | default "http"}}
      protocol: TCP
      name: http
  selector: {{ $selectorLabels }}
{{- end }}
{{- end }}
