mirror of
https://github.com/TeamPiped/Piped-Kubernetes.git
synced 2024-08-14 23:57:15 +00:00
36 lines
1,000 B
Smarty
36 lines
1,000 B
Smarty
|
{{/*
|
||
|
Ports included by the controller.
|
||
|
*/}}
|
||
|
{{- define "backend.controller.ports" -}}
|
||
|
{{- $ports := list -}}
|
||
|
{{- range .Values.backend.service -}}
|
||
|
{{- if .enabled -}}
|
||
|
{{- range $name, $port := .ports -}}
|
||
|
{{- $_ := set $port "name" $name -}}
|
||
|
{{- $ports = mustAppend $ports $port -}}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
|
||
|
{{/* export/render the list of ports */}}
|
||
|
{{- if $ports -}}
|
||
|
{{- range $_ := $ports }}
|
||
|
{{- if .enabled }}
|
||
|
- name: {{ .name }}
|
||
|
{{- if and .targetPort (kindIs "string" .targetPort) }}
|
||
|
{{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }}
|
||
|
{{- end }}
|
||
|
containerPort: {{ .targetPort | default .port }}
|
||
|
{{- if .protocol }}
|
||
|
{{- if or ( eq .protocol "HTTP" ) ( eq .protocol "HTTPS" ) ( eq .protocol "TCP" ) }}
|
||
|
protocol: TCP
|
||
|
{{- else }}
|
||
|
protocol: {{ .protocol }}
|
||
|
{{- end }}
|
||
|
{{- else }}
|
||
|
protocol: TCP
|
||
|
{{- end }}
|
||
|
{{- end}}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|