TrueChartsCatalogClone/stable/plex/12.0.12/templates/common.yaml

44 lines
1.3 KiB
YAML

{{/* Make sure all variables are set properly */}}
{{- include "tc.common.loader.init" . }}
{{- $adv := list -}}
{{- $serverURL := "" }}
{{- if not (eq .Values.service.main.type "ClusterIP") }}
{{- $serverURL = (printf "%v://%v:%v" (.Values.service.main.ports.main.protocol | lower) .Values.plex.serverIP .Values.service.main.ports.main.port) }}
{{- end }}
{{- $serverIngressURL := "" }}
{{- $host := "" }}
{{- if .Values.ingress.main.enabled }}
{{- with (first .Values.ingress.main.hosts) }}
{{- $host = .host }}
{{- $serverIngressURL = (printf "https://%v" .host) }}
{{- end }}
{{- end }}
{{- $serverIngressURLPort := "" }}
{{- if $host }}
{{- if not (eq .Values.service.main.type "ClusterIP") }}
{{- $port := .Values.service.main.ports.main.port }}
{{- $serverIngressURLPort = printf "https://%v:%v" $host $port }}
{{- end }}
{{- end }}
{{- with $serverURL }}
{{- $adv = append $adv . -}}
{{- end }}
{{- with $serverIngressURL }}
{{- $adv = append $adv . -}}
{{- end }}
{{- with $serverIngressURLPort }}
{{- $adv = append $adv . -}}
{{- end }}
{{- with .Values.plex.additionalAdvertiseURL }}
{{- $adv = append $adv . -}}
{{- end }}
{{- $_ := set .Values.env "ADVERTISE_IP" (join "," $adv) }}
{{/* Render the templates */}}
{{ include "tc.common.loader.apply" . }}