From d349af1a67c4a1cbbbfdb401cb61e177e227d22d Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Fri, 14 Jul 2023 04:51:58 -0400 Subject: [PATCH] migrate(midarr) migrate midarr to new common **BREAKING CHANGES** (#10382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** - Migrated app to new common and updated to the latest available version. - Added basic installation notes. ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [X] ⚠️ 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:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 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 - [X] ⬆️ 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._ --- .github/ct-install.yaml | 2 +- charts/incubator/midarr/Chart.yaml | 11 ++- .../midarr/docs/installation-notes.md | 5 ++ charts/incubator/midarr/questions.yaml | 50 ++++++++------ charts/incubator/midarr/templates/NOTES.txt | 1 + charts/incubator/midarr/templates/_config.tpl | 36 ---------- charts/incubator/midarr/templates/_secret.tpl | 29 -------- .../incubator/midarr/templates/_secrets.tpl | 67 +++++++++++++++++++ charts/incubator/midarr/templates/common.yaml | 14 ++-- charts/incubator/midarr/values.yaml | 54 ++++++++------- 10 files changed, 144 insertions(+), 125 deletions(-) create mode 100644 charts/incubator/midarr/docs/installation-notes.md create mode 100644 charts/incubator/midarr/templates/NOTES.txt delete mode 100644 charts/incubator/midarr/templates/_config.tpl delete mode 100644 charts/incubator/midarr/templates/_secret.tpl create mode 100644 charts/incubator/midarr/templates/_secrets.tpl diff --git a/.github/ct-install.yaml b/.github/ct-install.yaml index cf24ea2cedd..cf6da4362a8 100644 --- a/.github/ct-install.yaml +++ b/.github/ct-install.yaml @@ -12,6 +12,7 @@ chart-dirs: excluded-charts: - charts/dependency/subchart - charts/incubator/twingate-connector + - charts/incubator/midarr - charts/incubator/orbital-sync - charts/incubator/plex-meta-manager - charts/incubator/tauticord @@ -23,7 +24,6 @@ excluded-charts: - charts/stable/discordgsm - charts/stable/facebox - charts/stable/foundryvtt - - charts/stable/foundryvtt - charts/stable/heimdall - charts/stable/mc-router - charts/stable/multus diff --git a/charts/incubator/midarr/Chart.yaml b/charts/incubator/midarr/Chart.yaml index e9f87a372cd..5e3f76faae5 100644 --- a/charts/incubator/midarr/Chart.yaml +++ b/charts/incubator/midarr/Chart.yaml @@ -1,18 +1,15 @@ apiVersion: v2 -appVersion: "1.16.1" +appVersion: "3.1.0" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 - - condition: postgresql.enabled - name: postgresql - repository: https://deps.truecharts.org/ - version: 11.0.31 + version: 12.14.6 description: Midarr is a minimal lightweight media server for enjoying your media home: https://truecharts.org/charts/incubator/midarr icon: https://truecharts.org/img/hotlink-ok/chart-icons/midarr.png keywords: - midarr + - media kubeVersion: ">=1.16.0-0" maintainers: - email: info@truecharts.org @@ -22,7 +19,7 @@ name: midarr sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/midarr - https://github.com/midarrlabs/midarr-server -version: 3.0.22 +version: 4.0.0 annotations: truecharts.org/catagories: | - media diff --git a/charts/incubator/midarr/docs/installation-notes.md b/charts/incubator/midarr/docs/installation-notes.md new file mode 100644 index 00000000000..e34d248ca6c --- /dev/null +++ b/charts/incubator/midarr/docs/installation-notes.md @@ -0,0 +1,5 @@ +# Installation Notes + +Midarr requires a sonarr and radarr instance to be setup prior for the app to function. + +Its recommended all apps share the same internal path like /media when mounting your media libraries to these apps. diff --git a/charts/incubator/midarr/questions.yaml b/charts/incubator/midarr/questions.yaml index 3c13644063d..629f49f83a9 100644 --- a/charts/incubator/midarr/questions.yaml +++ b/charts/incubator/midarr/questions.yaml @@ -10,9 +10,9 @@ questions: # Include{replicas1} # Include{podSpec} # Include{containerMain} + # Include{containerBasic} # Include{containerAdvanced} - - variable: midarr group: App Configuration label: Midarr Configuration @@ -30,17 +30,20 @@ questions: label: Admin Mail schema: type: string + required: true default: "" - variable: name label: Admin Name schema: type: string + required: true default: "" - variable: pass label: Admin Password schema: type: string private: true + required: true default: "" - variable: general label: General Configuration @@ -59,7 +62,7 @@ questions: label: Mailer From schema: type: string - default: "" + default: "midarr@example.com" - variable: sendgrid_api_key label: SendGrid API Key schema: @@ -76,12 +79,14 @@ questions: label: Base URL schema: type: string + required: true default: "" - variable: api_key label: API Key schema: type: string private: true + required: true default: "" - variable: sonarr label: Sonarr Configuration @@ -93,14 +98,17 @@ questions: label: Base URL schema: type: string + required: true default: "" - variable: api_key label: API Key schema: type: string private: true + required: true default: "" # Include{containerConfig} +# Include{podOptions} # Include{serviceRoot} - variable: main label: Main Service @@ -141,28 +149,28 @@ questions: # Include{ingressAdvanced} # Include{ingressList} -# Include{podSecurityContextRoot} - - variable: runAsUser - label: runAsUser - description: The UserID of the user running the application - schema: - type: int - default: 0 - - variable: runAsGroup - label: runAsGroup - description: The groupID this App of the user running the application - schema: - type: int - default: 0 +# Include{securityContextRoot} + - variable: runAsUser + label: "runAsUser" + description: "The UserID of the user running the application" + schema: + type: int + default: 0 + - variable: runAsGroup + label: "runAsGroup" + description: "The groupID of the user running the application" + schema: + type: int + default: 0 # Include{securityContextContainer} # Include{securityContextAdvanced} # Include{securityContextPod} - - variable: fsGroup - label: fsGroup - description: The group that should own ALL storage. - schema: - type: int - default: 568 + - variable: fsGroup + label: "fsGroup" + description: "The group that should own ALL storage." + schema: + type: int + default: 568 # Include{resources} # Include{advanced} diff --git a/charts/incubator/midarr/templates/NOTES.txt b/charts/incubator/midarr/templates/NOTES.txt new file mode 100644 index 00000000000..efcb74cb772 --- /dev/null +++ b/charts/incubator/midarr/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/midarr/templates/_config.tpl b/charts/incubator/midarr/templates/_config.tpl deleted file mode 100644 index dcf4f8fca12..00000000000 --- a/charts/incubator/midarr/templates/_config.tpl +++ /dev/null @@ -1,36 +0,0 @@ -{{/* Define the configmap */}} -{{- define "midarr.config" -}} - -{{- $configName := printf "%s-config" (include "tc.common.names.fullname" .) }} - ---- - -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ $configName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -data: - DB_USERNAME: {{ .Values.postgresql.postgresqlUsername }} - DB_DATABASE: {{ .Values.postgresql.postgresqlDatabase }} - DB_HOSTNAME: {{ printf "%v-%v" .Release.Name "postgresql" }} - {{- with .Values.midarr.admin.mail }} - SETUP_ADMIN_EMAIL: {{ . }} - {{- end }} - {{- with .Values.midarr.admin.name }} - SETUP_ADMIN_NAME: {{ . }} - {{- end }} - {{- with .Values.midarr.radarr.base_url }} - RADARR_BASE_URL: {{ . }} - {{- end }} - {{- with .Values.midarr.sonarr.base_url }} - SONARR_BASE_URL: {{ . }} - {{- end }} - {{- with .Values.midarr.general.app_url }} - APP_URL: http://localhost:4000 - {{- end }} - {{- with .Values.midarr.general.app_mailer_from }} - APP_MAILER_FROM: example@email.com - {{- end }} -{{- end -}} diff --git a/charts/incubator/midarr/templates/_secret.tpl b/charts/incubator/midarr/templates/_secret.tpl deleted file mode 100644 index 6c73186a285..00000000000 --- a/charts/incubator/midarr/templates/_secret.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{{/* Define the secret */}} -{{- define "midarr.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 }} -data: - DB_PASSWORD: {{ .Values.postgresql.postgresqlPassword | trimAll "\"" | b64enc }} - {{- with .Values.midarr.admin.pass }} - SETUP_ADMIN_PASSWORD: {{ . | b64enc }} - {{- end }} - {{- with .Values.midarr.radarr.api_key }} - RADARR_API_KEY: {{ . | b64enc }} - {{- end }} - {{- with .Values.midarr.sonarr.api_key }} - SONARR_API_KEY: {{ . | b64enc }} - {{- end }} - {{- with .Values.midarr.general.sendgrid_api_key }} - SENDGRID_API_KEY: {{ . | b64enc }} - {{- end }} -{{- end }} diff --git a/charts/incubator/midarr/templates/_secrets.tpl b/charts/incubator/midarr/templates/_secrets.tpl new file mode 100644 index 00000000000..c9f5c3d9297 --- /dev/null +++ b/charts/incubator/midarr/templates/_secrets.tpl @@ -0,0 +1,67 @@ +{{/* Define the secrets */}} +{{- define "midarr.secrets" -}} +{{- $secretName := (printf "%s-midarr-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) -}} + +{{- $midarr := .Values.midarr -}} + +{{- $admin := $midarr.admin -}} +{{- $general := $midarr.general -}} +{{- $radarr := $midarr.radarr -}} +{{- $sonarr := $midarr.sonarr -}} + +{{- $host := printf "%v-cnpg-main-rw" (include "tc.v1.common.lib.chart.names.fullname" $) }} +{{- $password := .Values.cnpg.main.creds.password | trimAll "\"" }} + +enabled: true +data: + {{/* DB */}} + DB_USERNAME: {{ .Values.cnpg.main.user }} + DB_DATABASE: {{ .Values.cnpg.main.database }} + DB_HOSTNAME: {{ $host }} + DB_PASSWORD: {{ $password }} + + {{/* MIDARR */}} + {{- with $admin.mail }} + SETUP_ADMIN_EMAIL: {{ . }} + {{- end }} + + {{- with $admin.name }} + SETUP_ADMIN_NAME: {{ . }} + {{- end }} + + {{- with $admin.pass }} + SETUP_ADMIN_PASSWORD: {{ . | b64enc }} + {{- end }} + + {{/* GENERAL */}} + {{- with $general.app_url }} + APP_URL: http://localhost:4000 + {{- end }} + + {{- with $general.app_mailer_from }} + APP_MAILER_FROM: {{ . }} + {{- end }} + + {{- with $general.sendgrid_api_key }} + SENDGRID_API_KEY: {{ . | b64enc }} + {{- end }} + + {{/* RADARR */}} + {{- with $radarr.base_url }} + RADARR_BASE_URL: {{ . }} + {{- end }} + + {{- with $radarr.api_key }} + RADARR_API_KEY: {{ . | b64enc }} + {{- end }} + + {{/* SONARR */}} + {{- with $sonarr.base_url }} + SONARR_BASE_URL: {{ . }} + {{- end }} + + {{- with $sonarr.api_key }} + SONARR_API_KEY: {{ . | b64enc }} + {{- end }} + +{{- end -}} diff --git a/charts/incubator/midarr/templates/common.yaml b/charts/incubator/midarr/templates/common.yaml index 16d86426332..84706973c7b 100644 --- a/charts/incubator/midarr/templates/common.yaml +++ b/charts/incubator/midarr/templates/common.yaml @@ -1,11 +1,11 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . }} -{{/* Render config */}} -{{- include "midarr.config" . }} - -{{/* Render secret */}} -{{- include "midarr.secret" . }} +{{/* Render secrets for midarr */}} +{{- $secrets := include "midarr.secrets" . | fromYaml -}} +{{- if $secrets -}} + {{- $_ := set .Values.secret "midarr-secrets" $secrets -}} +{{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/midarr/values.yaml b/charts/incubator/midarr/values.yaml index aaa96c1dec6..188a501f798 100644 --- a/charts/incubator/midarr/values.yaml +++ b/charts/incubator/midarr/values.yaml @@ -1,15 +1,21 @@ image: repository: tccr.io/truecharts/midarr-server - tag: 1.16.1@sha256:5c0d69dbef7500b95aa11b9b51b8875a6355cfccc9cc57e9de202f574cf10b4f + tag: v3.1.0@sha256:5d85789b1a43cd6f7b133ae129d9f1dae4b97773e6c9f54b48094b1c86b47422 pullPolicy: IfNotPresent securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false + container: + runAsNonRoot: false + readOnlyRootFilesystem: false + runAsUser: 0 + runAsGroup: 0 -podSecurityContext: - runAsUser: 0 - runAsGroup: 0 +service: + main: + ports: + main: + port: 10347 + targetPort: 4000 midarr: admin: @@ -27,25 +33,25 @@ midarr: base_url: "" api_key: "" -envFrom: - - secretRef: - name: '{{ include "tc.common.names.fullname" . }}-secret' - - configMapRef: - name: '{{ include "tc.common.names.fullname" . }}-config' - -service: +workload: main: - ports: - main: - port: 10347 - protocol: HTTP - targetPort: 4000 + podSpec: + containers: + main: + command: + - sh + - -c + - chmod u+x entry-local.sh && ./entry-local.sh + envFrom: + - secretRef: + name: "midarr-secrets" -postgresql: - enabled: true - existingSecret: dbcreds - postgresqlUsername: midarr - postgresqlDatabase: midarr +cnpg: + main: + enabled: true + user: midarr + database: midarr portal: - enabled: true + open: + enabled: true