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/truecharts/charts/tree/master/charts/stable/plex
- https://github.com/k8s-at-home/container-images/pkgs/container/plex - https://github.com/k8s-at-home/container-images/pkgs/container/plex
type: application type: application
version: 11.0.4 version: 11.0.5
annotations: annotations:
truecharts.org/catagories: | truecharts.org/catagories: |
- media - media
+35 -35
View File
@@ -2,7 +2,7 @@
portals: portals:
open: open:
# Include{portalLink} # Include{portalLink}
path: "/web" path: /web
questions: questions:
# Include{global} # Include{global}
# Include{controller} # Include{controller}
@@ -10,57 +10,57 @@ questions:
# Include{replica1} # Include{replica1}
# Include{controllerExpertExtraArgs} # Include{controllerExpertExtraArgs}
- variable: plex - variable: plex
group: "App Configuration" group: App Configuration
label: "Plex Configuration" label: Plex Configuration
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: serverIP - variable: serverIP
label: "Server IP" label: Server IP
description: "Set to the IP-Address used to reach Plex." description: Set to the IP-Address used to reach Plex.
schema: schema:
type: string type: string
required: true required: true
$ref: $ref:
- "definitions/nodeIP" - definitions/nodeIP
- variable: additionalAdvertiseURL - variable: additionalAdvertiseURL
label: "Addition Advertise URLs" label: Addition Advertise URLs
description: "URLs to advertise to Plex, format http(s)://IPorDNS:3200. By default your serverIP and ingress URL is added" description: URLs to advertise to Plex, format http(s)://IPorDNS:3200. By default your serverIP and ingress URL is added"
schema: schema:
type: string type: string
valid_chars: '^$|^(http(s)?:\/\/([a-zA-Z0-9.-]*)(:\d{0,5})?,?)*$' valid_chars: '^$|^(http(s)?:\/\/([a-zA-Z0-9.-]*)(:\d{0,5})?,?)*$'
default: "" default: ""
- variable: disableGDM - variable: disableGDM
label: "Disable GDM" 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" description: Recommended to keep this to true. Disables legacy local network discovery. Keeping it enabled might break discovery for some Plex Clients
schema: schema:
type: boolean type: boolean
default: true default: true
- variable: env - variable: env
group: "App Configuration" group: App Configuration
label: "Image Environment" label: Image Environment
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: ALLOWED_NETWORKS - variable: ALLOWED_NETWORKS
label: "Allowed Networks" label: Allowed Networks
description: "Networks allowed to connect to plex. Add your local network IP to this list" description: Networks allowed to connect to plex. Add your local network IP to this list
schema: schema:
type: string 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 - variable: PLEX_CLAIM
label: "Plex Claim Token" 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." 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: schema:
type: string type: string
default: "" default: ""
# Include{containerConfig} # Include{containerConfig}
# Include{serviceRoot} # Include{serviceRoot}
- variable: main - variable: main
label: "Main Service" label: Main Service
description: "The Primary service on which the healthcheck runs, often the webUI" description: The Primary service on which the healthcheck runs, often the webUI
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
@@ -68,14 +68,14 @@ questions:
# Include{serviceSelectorLoadBalancer} # Include{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras} # Include{serviceSelectorExtras}
- variable: main - variable: main
label: "Main Service Port Configuration" label: Main Service Port Configuration
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: port - variable: port
label: "Port" label: Port
description: "This port exposes the container port on the service" description: This port exposes the container port on the service
schema: schema:
type: int type: int
default: 32400 default: 32400
@@ -86,8 +86,8 @@ questions:
# Include{serviceList} # Include{serviceList}
# Include{persistenceRoot} # Include{persistenceRoot}
- variable: config - variable: config
label: "App Config Storage" label: App Config Storage
description: "Stores the Application Configuration." description: Stores the Application Configuration.
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
@@ -96,7 +96,7 @@ questions:
# Include{persistenceList} # Include{persistenceList}
# Include{ingressRoot} # Include{ingressRoot}
- variable: main - variable: main
label: "Main Ingress" label: Main Ingress
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
@@ -108,41 +108,41 @@ questions:
# Include{security} # Include{security}
# Include{securityContextAdvancedRoot} # Include{securityContextAdvancedRoot}
- variable: privileged - variable: privileged
label: "Privileged mode" label: Privileged mode
schema: schema:
type: boolean type: boolean
default: false default: false
- variable: readOnlyRootFilesystem - variable: readOnlyRootFilesystem
label: "ReadOnly Root Filesystem" label: ReadOnly Root Filesystem
schema: schema:
type: boolean type: boolean
default: true default: true
- variable: allowPrivilegeEscalation - variable: allowPrivilegeEscalation
label: "Allow Privilege Escalation" label: Allow Privilege Escalation
schema: schema:
type: boolean type: boolean
default: false default: false
- variable: runAsNonRoot - variable: runAsNonRoot
label: "runAsNonRoot" label: runAsNonRoot
schema: schema:
type: boolean type: boolean
default: true default: true
# Include{podSecurityContextRoot} # Include{podSecurityContextRoot}
- variable: runAsUser - variable: runAsUser
label: "runAsUser" label: runAsUser
description: "The UserID of the user running the application" description: The UserID of the user running the application
schema: schema:
type: int type: int
default: 568 default: 568
- variable: runAsGroup - variable: runAsGroup
label: "runAsGroup" label: runAsGroup
description: "The groupID this App of the user running the application" description: The groupID this App of the user running the application
schema: schema:
type: int type: int
default: 568 default: 568
- variable: fsGroup - variable: fsGroup
label: "fsGroup" label: fsGroup
description: "The group that should own ALL storage." description: The group that should own ALL storage.
schema: schema:
type: int type: int
default: 568 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" mountPath: "/config"
plex: 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 # User Defined
serverIP: "127.0.0.1" serverIP: "127.0.0.1"
additionalAdvertiseURL: "" additionalAdvertiseURL: ""
disableGDM: true disableGDM: true
env: 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 }}' PLEX_PREFERENCE_GDM: 'GdmEnabled={{ ternary "0" "1" .Values.plex.disableGDM }}'
# User Defined # User Defined
ALLOWED_NETWORKS: "172.16.0.0/12,10.0.0.0/8,192.168.0.0/16" ALLOWED_NETWORKS: "172.16.0.0/12,10.0.0.0/8,192.168.0.0/16"