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] 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: