fix(plex): When ClusterIP, only advertise ingress host if any (#4412)

* fix(plex): When ClusterIP, only advertise ingress host if any

* also append additional urls

* clean
This commit is contained in:
Stavros Kois
2022-11-14 21:08:58 +01:00
committed by GitHub
parent 8a9310a9e3
commit 7a0582895a
4 changed files with 79 additions and 41 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ sources:
- https://github.com/truecharts/charts/tree/master/charts/stable/plex
- https://github.com/k8s-at-home/container-images/pkgs/container/plex
type: application
version: 11.0.4
version: 11.0.5
annotations:
truecharts.org/catagories: |
- media
+35 -35
View File
@@ -2,7 +2,7 @@
portals:
open:
# Include{portalLink}
path: "/web"
path: /web
questions:
# Include{global}
# Include{controller}
@@ -10,57 +10,57 @@ questions:
# Include{replica1}
# Include{controllerExpertExtraArgs}
- variable: plex
group: "App Configuration"
label: "Plex Configuration"
group: App Configuration
label: Plex Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: serverIP
label: "Server IP"
description: "Set to the IP-Address used to reach Plex."
label: Server IP
description: Set to the IP-Address used to reach Plex.
schema:
type: string
required: true
$ref:
- "definitions/nodeIP"
- definitions/nodeIP
- variable: additionalAdvertiseURL
label: "Addition Advertise URLs"
description: "URLs to advertise to Plex, format http(s)://IPorDNS:3200. By default your serverIP and ingress URL is added"
label: Addition Advertise URLs
description: URLs to advertise to Plex, format http(s)://IPorDNS:3200. By default your serverIP and ingress URL is added"
schema:
type: string
valid_chars: '^$|^(http(s)?:\/\/([a-zA-Z0-9.-]*)(:\d{0,5})?,?)*$'
default: ""
- variable: disableGDM
label: "Disable GDM"
description: "Recommended to keep this to true. Disables legacy local network discovery. Keeping it enabled might break discovery for some Plex Clients"
label: Disable GDM
description: Recommended to keep this to true. Disables legacy local network discovery. Keeping it enabled might break discovery for some Plex Clients
schema:
type: boolean
default: true
- variable: env
group: "App Configuration"
label: "Image Environment"
group: App Configuration
label: Image Environment
schema:
additional_attrs: true
type: dict
attrs:
- variable: ALLOWED_NETWORKS
label: "Allowed Networks"
description: "Networks allowed to connect to plex. Add your local network IP to this list"
label: Allowed Networks
description: Networks allowed to connect to plex. Add your local network IP to this list
schema:
type: string
default: "172.16.0.0/12,10.0.0.0/8,192.168.0.0/16"
default: 172.16.0.0/12,10.0.0.0/8,192.168.0.0/16
- variable: PLEX_CLAIM
label: "Plex Claim Token"
description: "Claim token to use to register the plex server (Max. 4 minutes old!). You can obtain a claim token to login your server to your plex account by visiting https://www.plex.tv/claim."
label: Plex Claim Token
description: Claim token to use to register the plex server (Max. 4 minutes old!). You can obtain a claim token to login your server to your plex account by visiting https://www.plex.tv/claim.
schema:
type: string
default: ""
# Include{containerConfig}
# Include{serviceRoot}
- variable: main
label: "Main Service"
description: "The Primary service on which the healthcheck runs, often the webUI"
label: Main Service
description: The Primary service on which the healthcheck runs, often the webUI
schema:
additional_attrs: true
type: dict
@@ -68,14 +68,14 @@ questions:
# Include{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras}
- variable: main
label: "Main Service Port Configuration"
label: Main Service Port Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: port
label: "Port"
description: "This port exposes the container port on the service"
label: Port
description: This port exposes the container port on the service
schema:
type: int
default: 32400
@@ -86,8 +86,8 @@ questions:
# Include{serviceList}
# Include{persistenceRoot}
- variable: config
label: "App Config Storage"
description: "Stores the Application Configuration."
label: App Config Storage
description: Stores the Application Configuration.
schema:
additional_attrs: true
type: dict
@@ -96,7 +96,7 @@ questions:
# Include{persistenceList}
# Include{ingressRoot}
- variable: main
label: "Main Ingress"
label: Main Ingress
schema:
additional_attrs: true
type: dict
@@ -108,41 +108,41 @@ questions:
# Include{security}
# Include{securityContextAdvancedRoot}
- variable: privileged
label: "Privileged mode"
label: Privileged mode
schema:
type: boolean
default: false
- variable: readOnlyRootFilesystem
label: "ReadOnly Root Filesystem"
label: ReadOnly Root Filesystem
schema:
type: boolean
default: true
- variable: allowPrivilegeEscalation
label: "Allow Privilege Escalation"
label: Allow Privilege Escalation
schema:
type: boolean
default: false
- variable: runAsNonRoot
label: "runAsNonRoot"
label: runAsNonRoot
schema:
type: boolean
default: true
# Include{podSecurityContextRoot}
- variable: runAsUser
label: "runAsUser"
description: "The UserID of the user running the application"
label: runAsUser
description: The UserID of the user running the application
schema:
type: int
default: 568
- variable: runAsGroup
label: "runAsGroup"
description: "The groupID this App of the user running the application"
label: runAsGroup
description: The groupID this App of the user running the application
schema:
type: int
default: 568
- variable: fsGroup
label: "fsGroup"
description: "The group that should own ALL storage."
label: fsGroup
description: The group that should own ALL storage.
schema:
type: int
default: 568
+43 -1
View File
@@ -1 +1,43 @@
{{ include "tc.common.loader.all" . }}
{{/* 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" . }}
-4
View File
@@ -17,16 +17,12 @@ persistence:
mountPath: "/config"
plex:
serverURL: "{{ .Values.service.main.ports.main.protocol | lower }}://{{ .Values.plex.serverIP }}:{{ .Values.service.main.ports.main.port }}"
serverIngressURL: "{{ if .Values.ingress.main.enabled }}{{ with (first .Values.ingress.main.hosts) }},https://{{ .host }}{{ end }}{{ end }}"
serverIngressURLPort: "{{ if .Values.ingress.main.enabled }}{{ $port := .Values.service.main.ports.main.port }}{{ with (first .Values.ingress.main.hosts) }},https://{{ .host }}:{{ $port }}{{ end }}{{ end }}"
# User Defined
serverIP: "127.0.0.1"
additionalAdvertiseURL: ""
disableGDM: true
env:
ADVERTISE_IP: "{{ tpl (.Values.plex.serverURL) .}}{{ tpl (.Values.plex.serverIngressURL) . }}{{ tpl (.Values.plex.serverIngressURLPort) . }}{{ with .Values.plex.additionalAdvertiseURL }},{{ . }}{{ end }}"
PLEX_PREFERENCE_GDM: 'GdmEnabled={{ ternary "0" "1" .Values.plex.disableGDM }}'
# User Defined
ALLOWED_NETWORKS: "172.16.0.0/12,10.0.0.0/8,192.168.0.0/16"