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

32 lines
854 B
Smarty
Raw Permalink Normal View History

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