diff --git a/kubernetes/apps/media/kustomization.yaml b/kubernetes/apps/media/kustomization.yaml index a0e6e1787..820645eab 100644 --- a/kubernetes/apps/media/kustomization.yaml +++ b/kubernetes/apps/media/kustomization.yaml @@ -25,3 +25,4 @@ resources: - ./kapowarr/ks.yaml - ./kaizoku/ks.yaml - ./recyclarr/ks.yaml + - ./midarr/ks.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 new file mode 100644 index 000000000..2bbe22844 --- /dev/null +++ b/kubernetes/apps/media/midarr/app/helmrelease.yaml @@ -0,0 +1,82 @@ +--- +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-charts + 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: v4.2.0@sha256:b368f94a8a7e0657125da108129ffbdc92d04fc7fba302ea88d9396b125b4d03 + env: + 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 + 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_DOMAIN}" + paths: + - path: / + pathType: Prefix + tls: + - hosts: + - *host + persistence: + nfs-nas-media: + enabled: true + existingClaim: media-nfs-share-pvc + mountPath: /media + readOnly: true + resources: + requests: + cpu: 100m + memory: 250Mi + limits: + memory: 1000Mi diff --git a/kubernetes/apps/media/midarr/app/kustomization.yaml b/kubernetes/apps/media/midarr/app/kustomization.yaml new file mode 100644 index 000000000..712226918 --- /dev/null +++ b/kubernetes/apps/media/midarr/app/kustomization.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./helmrelease.yaml + - ./externalsecret.yaml + - ./gatus.yaml diff --git a/kubernetes/apps/media/midarr/ks.yaml b/kubernetes/apps/media/midarr/ks.yaml new file mode 100644 index 000000000..b97f207c6 --- /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-midarr + namespace: flux-system +spec: + dependsOn: + - name: cluster-apps-ingress-nginx + path: ./kubernetes/apps/media/midarr/app + prune: true + sourceRef: + kind: GitRepository + name: home-kubernetes + healthChecks: + - apiVersion: helm.toolkit.fluxcd.io/v2beta1 + kind: HelmRelease + name: midarr + namespace: media + interval: 30m + retryInterval: 1m + timeout: 3m