fix(plex): use https for servicetype (#8270)

**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes #8182 
⚒️ Fixes #8150

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [x] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Kjeld Schouten-Lebbing
2023-04-29 08:43:02 +02:00
committed by GitHub
parent 5edba8bbbc
commit 030fcbb41e
6 changed files with 75 additions and 46 deletions

View File

View File

@@ -0,0 +1,2 @@
plex:
requireHTTPS: true

View File

@@ -7,11 +7,9 @@ questions:
# Include{global}
# Include{workload}
# Include{workloadDeployment}
# Include{replicas1}
# Include{podSpec}
# Include{containerMain}
- variable: env
group: App Configuration
label: Image Environment
@@ -31,11 +29,8 @@ questions:
schema:
type: string
default: ""
# Include{containerBasic}
# Include{containerAdvanced}
- variable: plex
group: App Configuration
label: Plex Configuration
@@ -64,8 +59,15 @@ questions:
schema:
type: boolean
default: true
- variable: requireHTTPS
label: Require HTTPS
description: Please use this toggle to "Require HTTPS", do not use the Plex UI.
schema:
type: boolean
default: true
# Include{containerConfig}
# Include{podOptions}
# Include{serviceRoot}
# Include{serviceMain}
# Include{serviceSelectorLoadBalancer}
@@ -109,7 +111,6 @@ questions:
# Include{ingressTraefik}
# Include{ingressList}
# Include{securityContextRoot}
- variable: runAsUser
label: "runAsUser"
description: "The UserID of the user running the application"
@@ -131,7 +132,6 @@ questions:
schema:
type: int
default: 568
# Include{resources}
# Include{advanced}
# Include{addons}

View File

@@ -1,43 +1,52 @@
{{/* Make sure all variables are set properly */}}
{{- include "tc.v1.common.loader.init" . }}
{{- include "tc.v1.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 }}
{{- $serverURL := "" -}}
{{- $protocol := "http" -}}
{{- if .Values.plex.requireHTTPS -}}
{{- $protocol = "https" -}}
{{- end -}}
{{- $serverIngressURL := "" }}
{{- $host := "" }}
{{- if .Values.ingress.main.enabled }}
{{- with (first .Values.ingress.main.hosts) }}
{{- $host = .host }}
{{- $serverIngressURL = (printf "https://%v" .host) }}
{{- end }}
{{- end }}
{{- $_ := set .Values.workload.main.podSpec.containers.main.probes.liveness "protocol" $protocol -}}
{{- $_ := set .Values.workload.main.podSpec.containers.main.probes.readiness "protocol" $protocol -}}
{{- $_ := set .Values.workload.main.podSpec.containers.main.probes.startup "protocol" $protocol -}}
{{- $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 }}
{{- if not (eq .Values.service.main.type "ClusterIP") -}}
{{- $serverURL = (printf "%v://%v:%v" $protocol .Values.plex.serverIP .Values.service.main.ports.main.port) -}}
{{- 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 }}
{{- $serverIngressURL := "" -}}
{{- $host := "" -}}
{{- if .Values.ingress.main.enabled -}}
{{- with (first .Values.ingress.main.hosts) -}}
{{- $host = .host -}}
{{- $serverIngressURL = (printf "https://%v" .host) -}}
{{- end -}}
{{- end -}}
{{- $_ := set .Values.workload.main.podSpec.containers.main.env "ADVERTISE_IP" (join "," $adv) }}
{{- $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.workload.main.podSpec.containers.main.env "ADVERTISE_IP" (join "," $adv) -}}
{{/* Render the templates */}}
{{ include "tc.v1.common.loader.apply" . }}
{{- include "tc.v1.common.loader.apply" . -}}

View File

@@ -9,27 +9,45 @@ service:
protocol: http
port: 32400
targetPort: 32400
persistence:
config:
enabled: true
mountPath: "/config"
plex:
# User Defined
serverIP: "127.0.0.1"
additionalAdvertiseURL: ""
disableGDM: true
portal:
open:
enabled: true
requireHTTPS: true
workload:
main:
podSpec:
containers:
main:
probes:
liveness:
enabled: true
path: /identity
protocol: http
readiness:
enabled: true
path: /identity
protocol: http
startup:
enabled: true
path: /identity
protocol: http
env:
PLEX_PREFERENCE_GDM: 'GdmEnabled={{ ternary "0" "1" .Values.plex.disableGDM }}'
# 0=Required, 1=Preferred
PLEX_PREFERENCE_SEC_CON: 'secureConnections={{ ternary "0" "1" .Values.plex.requireHTTPS }}'
# User Defined
ALLOWED_NETWORKS: "172.16.0.0/12,10.0.0.0/8,192.168.0.0/16"
PLEX_CLAIM: ""
portal:
open:
enabled: true

View File

@@ -4,7 +4,7 @@
description: When supported by the container, this sets the User ID running the Application Process. Not supported by all Apps
schema:
type: int
show_if: [["runAsUser", "=", "0"]]
show_if: [["runAsUser", "=", 0]]
default: 568
- variable: UMASK
label: UMASK