softplayer-helm-lib/charts/workload/templates/service/_services.tpl

32 lines
854 B
Smarty

{{- define "lib.services" }}
{{- range $k, $v := .Values.services }}
{{- $customName := printf "%s-%s" (include "chart.fullname" $) $k }}
---
# ---------------------------------------------------------------------
# This service is created as a part of softplayer helm library
# please see /lib/tempaltes/service/_service.tpl
# ---------------------------------------------------------------------
apiVersion: v1
kind: Service
{{- include "lib.metadata" (dict "Context" $ "customName" $customName)}}
spec:
{{- if ($v).type }}
type: {{ $v.type }}
{{- else }}
type: ClusterIP
{{- end }}
selector:
{{ include "metadata.selectorLabels" $ | indent 4}}
ports:
{{- range $k,$v := $v.ports }}
- name: {{ $k }}
port: {{ $v.port }}
targetPort: {{ $v.targetPort}}
protocol: {{ $v.protocol}}
{{- end }}
{{- end }}
{{- end -}}