From ace5cefc4f6d045d43e3b3a0839ff8a70de340a4 Mon Sep 17 00:00:00 2001 From: axeII <13370338+axeII@users.noreply.github.com> Date: Tue, 27 Jun 2023 21:21:43 +0200 Subject: [PATCH 1/3] feat: adds midarr to the cluster --- kubernetes/apps/media/kustomization.yaml | 1 + .../apps/media/midarr/app/helmrelease.yaml | 86 +++++++++++++++++++ kubernetes/apps/media/midarr/ks.yaml | 22 +++++ 3 files changed, 109 insertions(+) create mode 100644 kubernetes/apps/media/midarr/app/helmrelease.yaml create mode 100644 kubernetes/apps/media/midarr/ks.yaml diff --git a/kubernetes/apps/media/kustomization.yaml b/kubernetes/apps/media/kustomization.yaml index 98edbee44..6e3cfcd55 100644 --- a/kubernetes/apps/media/kustomization.yaml +++ b/kubernetes/apps/media/kustomization.yaml @@ -26,3 +26,4 @@ resources: - ./flaresolverr/ks.yaml - ./kapowarr/ks.yaml - ./kaizoku/ks.yaml + - ./midarr/ks.yaml diff --git a/kubernetes/apps/media/midarr/app/helmrelease.yaml b/kubernetes/apps/media/midarr/app/helmrelease.yaml new file mode 100644 index 000000000..43578a71a --- /dev/null +++ b/kubernetes/apps/media/midarr/app/helmrelease.yaml @@ -0,0 +1,86 @@ +--- +# yaml-language-server: $schema=https://kubernetes-schemas.devbu.io/helm.toolkit.fluxcd.io/helmrelease_v2beta1.json +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: midarr + namespace: media +spec: + interval: 30m + chart: + spec: + chart: app-template + version: 1.5.1 + sourceRef: + kind: HelmRepository + name: bjw-s + namespace: flux-system + maxHistory: 2 + install: + createNamespace: true + remediation: + retries: 3 + upgrade: + cleanupOnFail: true + remediation: + retries: 3 + uninstall: + keepHistory: false + values: + initContainers: + 01-init-db: + image: ghcr.io/onedr0p/postgres-init:14.8 + imagePullPolicy: IfNotPresent + envFrom: + - secretRef: + name: midarr-secret + controller: + replicas: 2 + strategy: RollingUpdate + annotations: + reloader.stakater.com/auto: "true" + image: + repository: ghcr.io/midarrlabs/midarr-server + tag: v3.1.0-beta.2 + env: + TZ: America/New_York + APP_URL: http://midarr.media.svc.cluster.local:4000 + RADARR_BASE_URL: radarr.media.svc.cluster.local + SONARR_BASE_URL: sonarr.media.svc.cluster.local + envFrom: + - secretRef: + name: midarr-secret + service: + main: + ports: + http: + port: 4000 + ingress: + main: + enabled: true + ingressClassName: nginx + annotations: + hajimari.io/icon: mdi:play-circle-outline + hosts: + - host: &host "{{ .Release.Name }}.${SECRET_PUBLIC_DOMAIN}" + paths: + - path: / + pathType: Prefix + tls: + - hosts: + - *host + secretName: midarr-tls + persistence: + media: + enabled: true + type: nfs + server: osiris.286k.co + path: /pluto/media + mountPath: /media + readOnly: true + resources: + requests: + cpu: 100m + memory: 250Mi + limits: + memory: 1000Mi diff --git a/kubernetes/apps/media/midarr/ks.yaml b/kubernetes/apps/media/midarr/ks.yaml new file mode 100644 index 000000000..3590c714d --- /dev/null +++ b/kubernetes/apps/media/midarr/ks.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: cluster-apps-sonarr + namespace: flux-system +spec: + dependsOn: + - name: cluster-apps-longhorn + path: ./kubernetes/apps/media/sonarr/app + prune: true + sourceRef: + kind: GitRepository + name: home-kubernetes + healthChecks: + - apiVersion: helm.toolkit.fluxcd.io/v2beta1 + kind: HelmRelease + name: sonarr + namespace: media + interval: 30m + retryInterval: 1m + timeout: 3m From e73532a73d83bd4d5e385c0284591efe2d75752f Mon Sep 17 00:00:00 2001 From: axeII <13370338+axeII@users.noreply.github.com> Date: Tue, 27 Jun 2023 21:29:59 +0200 Subject: [PATCH 2/3] fixes: and updates midarr configuration --- kubernetes/apps/media/midarr/app/helmrelease.yaml | 12 ++++-------- kubernetes/apps/media/midarr/app/kustomization.yaml | 6 ++++++ kubernetes/apps/media/midarr/ks.yaml | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 kubernetes/apps/media/midarr/app/kustomization.yaml diff --git a/kubernetes/apps/media/midarr/app/helmrelease.yaml b/kubernetes/apps/media/midarr/app/helmrelease.yaml index 43578a71a..b35556d72 100644 --- a/kubernetes/apps/media/midarr/app/helmrelease.yaml +++ b/kubernetes/apps/media/midarr/app/helmrelease.yaml @@ -1,5 +1,4 @@ --- -# yaml-language-server: $schema=https://kubernetes-schemas.devbu.io/helm.toolkit.fluxcd.io/helmrelease_v2beta1.json apiVersion: helm.toolkit.fluxcd.io/v2beta1 kind: HelmRelease metadata: @@ -43,7 +42,7 @@ spec: repository: ghcr.io/midarrlabs/midarr-server tag: v3.1.0-beta.2 env: - TZ: America/New_York + TZ: ${TIMEZONE} APP_URL: http://midarr.media.svc.cluster.local:4000 RADARR_BASE_URL: radarr.media.svc.cluster.local SONARR_BASE_URL: sonarr.media.svc.cluster.local @@ -62,20 +61,17 @@ spec: annotations: hajimari.io/icon: mdi:play-circle-outline hosts: - - host: &host "{{ .Release.Name }}.${SECRET_PUBLIC_DOMAIN}" + - host: &host "{{ .Release.Name }}.${SECRET_DOMAIN}" paths: - path: / pathType: Prefix tls: - hosts: - *host - secretName: midarr-tls persistence: - media: + nfs-nas-media: enabled: true - type: nfs - server: osiris.286k.co - path: /pluto/media + existingClaim: media-nfs-share-pvc mountPath: /media readOnly: true resources: diff --git a/kubernetes/apps/media/midarr/app/kustomization.yaml b/kubernetes/apps/media/midarr/app/kustomization.yaml new file mode 100644 index 000000000..06065f3e1 --- /dev/null +++ b/kubernetes/apps/media/midarr/app/kustomization.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./helmrelease.yaml + # - ./secret.sops.yaml diff --git a/kubernetes/apps/media/midarr/ks.yaml b/kubernetes/apps/media/midarr/ks.yaml index 3590c714d..cdb3a4675 100644 --- a/kubernetes/apps/media/midarr/ks.yaml +++ b/kubernetes/apps/media/midarr/ks.yaml @@ -6,8 +6,8 @@ metadata: namespace: flux-system spec: dependsOn: - - name: cluster-apps-longhorn - path: ./kubernetes/apps/media/sonarr/app + - name: cluster-apps-ingress-nginx + path: ./kubernetes/apps/media/midarr/app prune: true sourceRef: kind: GitRepository @@ -15,7 +15,7 @@ spec: healthChecks: - apiVersion: helm.toolkit.fluxcd.io/v2beta1 kind: HelmRelease - name: sonarr + name: midarr namespace: media interval: 30m retryInterval: 1m From f01a129a7233ce781a299c3ce394758b187fe9ba Mon Sep 17 00:00:00 2001 From: axeII <13370338+axeII@users.noreply.github.com> Date: Wed, 24 Jan 2024 23:20:40 +0100 Subject: [PATCH 3/3] refactors: midarr's helm release also adds gatus, externalsecret --- .../apps/media/midarr/app/externalsecret.yaml | 44 +++++++++++++++++++ kubernetes/apps/media/midarr/app/gatus.yaml | 22 ++++++++++ .../apps/media/midarr/app/helmrelease.yaml | 4 +- .../apps/media/midarr/app/kustomization.yaml | 3 +- kubernetes/apps/media/midarr/ks.yaml | 2 +- 5 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 kubernetes/apps/media/midarr/app/externalsecret.yaml create mode 100644 kubernetes/apps/media/midarr/app/gatus.yaml diff --git a/kubernetes/apps/media/midarr/app/externalsecret.yaml b/kubernetes/apps/media/midarr/app/externalsecret.yaml new file mode 100644 index 000000000..3543f3f1a --- /dev/null +++ b/kubernetes/apps/media/midarr/app/externalsecret.yaml @@ -0,0 +1,44 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/axeII/crds/main/externalsecret_v1beta1.json +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: midarr + namespace: media +spec: + secretStoreRef: + kind: ClusterSecretStore + name: onepassword-connect + target: + name: midarr-secret + creationPolicy: Owner + template: + engineVersion: v2 + data: + # App + SETUP_ADMIN_EMAIL: "{{ .SETUP_ADMIN_EMAIL }}" + SETUP_ADMIN_NAME: "{{ .SETUP_ADMIN_NAME }}" + SETUP_ADMIN_PASSWORD: "{{ .SETUP_ADMIN_PASSWORD }}" + RADARR_API_KEY: "{{ .RADARR__API_KEY }}" + SONARR_API_KEY: "{{ .SONARR__API_KEY }}" + DB_HOSTNAME: &dbHost postgresql.database.svc.cluster.local + DB_DATABASE: &dbName midarr + DB_USERNAME: &dbUser "{{ .DB_USERNAME }}" + DB_PASSWORD: &dbPass "{{ .DB_PASSWORD }}" + # Postgres Init + INIT_POSTGRES_DBNAME: *dbName + INIT_POSTGRES_HOST: *dbHost + INIT_POSTGRES_USER: *dbUser + INIT_POSTGRES_PASS: *dbPass + INIT_POSTGRES_SUPER_PASS: "{{ .POSTGRES_SUPER_PASS }}" + dataFrom: + - extract: + key: midarr + - extract: + key: cloudnative-pg + - extract: + key: radarr + property: RADARR__API_KEY + - extract: + key: sonarr + property: SONARR__API_KEY diff --git a/kubernetes/apps/media/midarr/app/gatus.yaml b/kubernetes/apps/media/midarr/app/gatus.yaml new file mode 100644 index 000000000..8d02373dd --- /dev/null +++ b/kubernetes/apps/media/midarr/app/gatus.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: midarr-gatus-ep + namespace: monitoring + labels: + gatus.io/enabled: "true" +data: + config.yaml: | + endpoints: + - name: midarr + url: https://midarr.${SECRET_DOMAIN} + group: media + interval: 1m + conditions: ["[STATUS] == 200"] + client: + dns-resolver: udp://192.168.69.106:53 + alerts: + - type: discord + description: "healthcheck failed" + send-on-resolved: true diff --git a/kubernetes/apps/media/midarr/app/helmrelease.yaml b/kubernetes/apps/media/midarr/app/helmrelease.yaml index b35556d72..2bbe22844 100644 --- a/kubernetes/apps/media/midarr/app/helmrelease.yaml +++ b/kubernetes/apps/media/midarr/app/helmrelease.yaml @@ -12,7 +12,7 @@ spec: version: 1.5.1 sourceRef: kind: HelmRepository - name: bjw-s + name: bjw-s-charts namespace: flux-system maxHistory: 2 install: @@ -40,7 +40,7 @@ spec: reloader.stakater.com/auto: "true" image: repository: ghcr.io/midarrlabs/midarr-server - tag: v3.1.0-beta.2 + tag: v4.2.0@sha256:b368f94a8a7e0657125da108129ffbdc92d04fc7fba302ea88d9396b125b4d03 env: TZ: ${TIMEZONE} APP_URL: http://midarr.media.svc.cluster.local:4000 diff --git a/kubernetes/apps/media/midarr/app/kustomization.yaml b/kubernetes/apps/media/midarr/app/kustomization.yaml index 06065f3e1..712226918 100644 --- a/kubernetes/apps/media/midarr/app/kustomization.yaml +++ b/kubernetes/apps/media/midarr/app/kustomization.yaml @@ -3,4 +3,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ./helmrelease.yaml - # - ./secret.sops.yaml + - ./externalsecret.yaml + - ./gatus.yaml diff --git a/kubernetes/apps/media/midarr/ks.yaml b/kubernetes/apps/media/midarr/ks.yaml index cdb3a4675..b97f207c6 100644 --- a/kubernetes/apps/media/midarr/ks.yaml +++ b/kubernetes/apps/media/midarr/ks.yaml @@ -2,7 +2,7 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: - name: cluster-apps-sonarr + name: cluster-apps-midarr namespace: flux-system spec: dependsOn: