From fd81281a3f4f90b089181245b1518014829ceb7f Mon Sep 17 00:00:00 2001 From: StevenMcElligott <89483932+StevenMcElligott@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:02:07 -0400 Subject: [PATCH] migrate(Funkwhale): Migrate to new common (#11004) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Let's get this on the new common ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ 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: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros kois --- charts/incubator/funkwhale/Chart.yaml | 4 +- charts/incubator/funkwhale/questions.yaml | 43 ++++++++++--------- .../incubator/funkwhale/templates/NOTES.txt | 1 + .../incubator/funkwhale/templates/_secret.tpl | 24 +++-------- .../incubator/funkwhale/templates/common.yaml | 11 +++-- charts/incubator/funkwhale/values.yaml | 36 +++++++++------- 6 files changed, 59 insertions(+), 60 deletions(-) create mode 100644 charts/incubator/funkwhale/templates/NOTES.txt diff --git a/charts/incubator/funkwhale/Chart.yaml b/charts/incubator/funkwhale/Chart.yaml index f95c69d6ed6..e85938709fd 100644 --- a/charts/incubator/funkwhale/Chart.yaml +++ b/charts/incubator/funkwhale/Chart.yaml @@ -8,7 +8,7 @@ appVersion: "1.2.10" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 + version: 13.2.1 deprecated: false description: Funkwhale is designed to make it easy to listen to music you like, and to discover new artists. home: https://truecharts.org/charts/incubator/funkwhale @@ -27,4 +27,4 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/funkwhale - https://funkwhale.audio/ type: application -version: 2.1.10 +version: 3.0.0 diff --git a/charts/incubator/funkwhale/questions.yaml b/charts/incubator/funkwhale/questions.yaml index 08cd8c617ed..ca6fe48d0b2 100644 --- a/charts/incubator/funkwhale/questions.yaml +++ b/charts/incubator/funkwhale/questions.yaml @@ -10,29 +10,30 @@ questions: # Include{replicas1} # Include{podSpec} # Include{containerMain} + + - variable: env + group: "App Configuration" + label: "Image Environment" + schema: + additional_attrs: true + type: dict + attrs: + - variable: FUNKWHALE_HOSTNAME + label: "FUNKWHALE_HOSTNAME" + description: "Container Variable FUNKWHALEHOSTNAME" + schema: + type: string + default: "yourdomain.funkwhale" + - variable: NESTED_PROXY + label: "NESTED_PROXY" + description: "Container Variable NESTEDPROXY Set to 1 when container is behind a reverse proxy." + schema: + type: string + default: "0" # Include{containerBasic} # Include{containerAdvanced} - - - variable: env - group: "App Configuration" - label: "Image Environment" - schema: - additional_attrs: true - type: dict - attrs: - - variable: FUNKWHALE_HOSTNAME - label: "FUNKWHALE_HOSTNAME" - description: "Container Variable FUNKWHALEHOSTNAME" - schema: - type: string - default: "yourdomain.funkwhale" - - variable: NESTED_PROXY - label: "NESTED_PROXY" - description: "Container Variable NESTEDPROXY Set to 1 when container is behind a reverse proxy." - schema: - type: string - default: "0" # Include{containerConfig} +# Include{podOptions} # Include{serviceRoot} - variable: main label: "Main Service" @@ -54,7 +55,7 @@ questions: description: "This port exposes the container port on the service" schema: type: int - default: 3030 + default: 10236 required: true # Include{serviceExpertRoot} # Include{serviceExpert} diff --git a/charts/incubator/funkwhale/templates/NOTES.txt b/charts/incubator/funkwhale/templates/NOTES.txt new file mode 100644 index 00000000000..efcb74cb772 --- /dev/null +++ b/charts/incubator/funkwhale/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/funkwhale/templates/_secret.tpl b/charts/incubator/funkwhale/templates/_secret.tpl index 618074fddbb..d6fb708d4ae 100644 --- a/charts/incubator/funkwhale/templates/_secret.tpl +++ b/charts/incubator/funkwhale/templates/_secret.tpl @@ -1,21 +1,11 @@ {{/* Define the secret */}} {{- define "funkwhale.secret" -}} - -{{- $secretName := printf "%s-secret" (include "tc.common.names.fullname" .) -}} - ---- - -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - name: {{ $secretName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} +{{- $fetchname := printf "%s-secret" (include "tc.v1.common.lib.chart.names.fullname" $) -}} +{{- $key := randAlphaNum 32 -}} +{{- with (lookup "v1" "Secret" .Release.Namespace $fetchname) -}} + {{- $key = index .data "DJANGO_SECRET_KEY" | b64dec -}} +{{- end }} +enabled: true data: - {{- with (lookup "v1" "Secret" .Release.Namespace $secretName) }} - DJANGO_SECRET_KEY: {{ (index .data "DJANGO_SECRET_KEY") }} - {{- else }} - DJANGO_SECRET_KEY: {{ randAlphaNum 32 | b64enc }} - {{- end }} + DJANGO_SECRET_KEY: {{ $key }} {{- end -}} diff --git a/charts/incubator/funkwhale/templates/common.yaml b/charts/incubator/funkwhale/templates/common.yaml index 066683a70af..b67b24fe862 100644 --- a/charts/incubator/funkwhale/templates/common.yaml +++ b/charts/incubator/funkwhale/templates/common.yaml @@ -1,8 +1,11 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . }} -{{/* Render secret */}} -{{- include "funkwhale.secret" . }} +{{/* Render secrets for Funkwhalte */}} +{{- $secrets := include "funkwhale.secret" . | fromYaml -}} +{{- if $secrets -}} + {{- $_ := set .Values.secret "secret" $secrets -}} +{{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/funkwhale/values.yaml b/charts/incubator/funkwhale/values.yaml index 56299a41aae..4af67921fee 100644 --- a/charts/incubator/funkwhale/values.yaml +++ b/charts/incubator/funkwhale/values.yaml @@ -3,28 +3,32 @@ image: repository: tccr.io/truecharts/funkwhale tag: 1.2.10@sha256:835a4970cd330024e617e6b320f609b700ee79f042b57118ad761605fbd985d1 -podSecurityContext: - runAsGroup: 0 - runAsUser: 0 - securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false + container: + readOnlyRootFilesystem: false + runAsNonRoot: false + runAsGroup: 0 + runAsUser: 0 -env: - DJANGO_SECRET_KEY: - secretKeyRef: - name: '{{ printf "%s-secret" (include "tc.common.names.fullname" .) }}' - key: DJANGO_SECRET_KEY - FUNKWHALE_HOSTNAME: yourdomain.funkwhale - NESTED_PROXY: "0" +workload: + main: + podSpec: + containers: + main: + env: + FUNKWHALE_HOSTNAME: "yourdomain.funkwhale" + NESTED_PROXY: "0" + DJANGO_SECRET_KEY: + secretKeyRef: + name: secret + key: DJANGO_SECRET_KEY service: main: ports: main: port: 10236 - protocol: HTTP + protocol: http targetPort: 5000 persistence: @@ -34,7 +38,7 @@ persistence: musicpath: enabled: true mountPath: /music - readOnly: true portal: - enabled: true + open: + enabled: true