diff --git a/clusters/cl01tl/applications/sonarr-4k/Chart.yaml b/clusters/cl01tl/applications/sonarr-4k/Chart.yaml new file mode 100644 index 000000000..4181cae62 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/Chart.yaml @@ -0,0 +1,31 @@ +apiVersion: v2 +name: sonarr-4k +version: 1.0.0 +description: Sonarr v4 4K +keywords: + - sonarr + - servarr + - tv shows + - 4k + - metrics +home: https://wiki.alexlebens.dev/doc/sonarr-AvJLY9PxEy +sources: + - https://github.com/Sonarr/Sonarr + - https://github.com/cloudnative-pg/cloudnative-pg + - https://github.com/onedr0p/containers/pkgs/container/sonarr + - https://github.com/onedr0p/exportarr/pkgs/container/exportarr + - https://github.com/bjw-s/helm-charts/tree/main/charts/other/app-template + - https://github.com/alexlebens/helm-charts/charts/postgres-cluster +maintainers: + - name: alexlebens +dependencies: + - name: app-template + alias: sonarr-4k + repository: https://bjw-s.github.io/helm-charts/ + version: 3.7.1 + - name: postgres-cluster + alias: postgres-17-cluster + version: 4.2.0 + repository: http://alexlebens.github.io/helm-charts +icon: https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/png/sonarr.png +appVersion: 4.0.11 diff --git a/clusters/cl01tl/applications/sonarr-4k/templates/external-secret.yaml b/clusters/cl01tl/applications/sonarr-4k/templates/external-secret.yaml new file mode 100644 index 000000000..59fc1b744 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/templates/external-secret.yaml @@ -0,0 +1,89 @@ +# apiVersion: external-secrets.io/v1beta1 +# kind: ExternalSecret +# metadata: +# name: sonarr-4k-config-backup-secret +# namespace: {{ .Release.Namespace }} +# labels: +# app.kubernetes.io/name: sonarr-4k-config-backup-secret +# app.kubernetes.io/instance: {{ .Release.Name }} +# app.kubernetes.io/version: {{ .Chart.AppVersion }} +# app.kubernetes.io/component: backup +# app.kubernetes.io/part-of: {{ .Release.Name }} +# spec: +# secretStoreRef: +# kind: ClusterSecretStore +# name: vault +# target: +# template: +# mergePolicy: Merge +# engineVersion: v2 +# data: +# RESTIC_REPOSITORY: "{{ `{{ .BUCKET_ENDPOINT }}` }}/sonarr4-4k/sonarr4-4k-config" +# data: +# - secretKey: BUCKET_ENDPOINT +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: S3_BUCKET_ENDPOINT +# - secretKey: RESTIC_PASSWORD +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: RESTIC_PASSWORD +# - secretKey: AWS_DEFAULT_REGION +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: AWS_DEFAULT_REGION +# - secretKey: AWS_ACCESS_KEY_ID +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /digital-ocean/home-infra/volsync-backups +# metadataPolicy: None +# property: access_key +# - secretKey: AWS_SECRET_ACCESS_KEY +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /digital-ocean/home-infra/volsync-backups +# metadataPolicy: None +# property: secret_key + +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: sonarr-4k-postgresql-17-cluster-backup-secret + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-4k-postgresql-17-cluster-backup-secret + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: database + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + data: + - secretKey: ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/postgres-backups + metadataPolicy: None + property: access + - secretKey: ACCESS_SECRET_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/postgres-backups + metadataPolicy: None + property: secret diff --git a/clusters/cl01tl/applications/sonarr-4k/templates/http-route.yaml b/clusters/cl01tl/applications/sonarr-4k/templates/http-route.yaml new file mode 100644 index 000000000..169ba963f --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/templates/http-route.yaml @@ -0,0 +1,30 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: http-route-sonarr-4k + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: http-route-sonarr-4k + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + parentRefs: + - group: gateway.networking.k8s.io + kind: Gateway + name: traefik-gateway + namespace: traefik + hostnames: + - sonarr-4k.alexlebens.net + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - group: '' + kind: Service + name: sonarr-4k + port: 80 + weight: 100 diff --git a/clusters/cl01tl/applications/sonarr-4k/templates/persistent-volume-claim.yaml b/clusters/cl01tl/applications/sonarr-4k/templates/persistent-volume-claim.yaml new file mode 100644 index 000000000..382f2f7c9 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/templates/persistent-volume-claim.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: sonarr-4k-nfs-storage + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-4k-nfs-storage + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: storage + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + volumeName: sonarr-4k-nfs-storage + storageClassName: nfs-client + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Gi diff --git a/clusters/cl01tl/applications/sonarr-4k/templates/persistent-volume.yaml b/clusters/cl01tl/applications/sonarr-4k/templates/persistent-volume.yaml new file mode 100644 index 000000000..e2ae6371e --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/templates/persistent-volume.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: sonarr-4k-nfs-storage + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-4k-nfs-storage + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: storage + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + persistentVolumeReclaimPolicy: Retain + storageClassName: nfs-client + capacity: + storage: 1Gi + accessModes: + - ReadWriteMany + nfs: + path: /volume2/Storage + server: synologybond.alexlebens.net + mountOptions: + - vers=4 + - minorversion=1 + - noac diff --git a/clusters/cl01tl/applications/sonarr-4k/templates/prometheus-rule.yaml b/clusters/cl01tl/applications/sonarr-4k/templates/prometheus-rule.yaml new file mode 100644 index 000000000..30e84f1ec --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/templates/prometheus-rule.yaml @@ -0,0 +1,34 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: sonarr-4k + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-4k + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + groups: + - name: sonarr-4k + rules: + - alert: ExportarrAbsent + annotations: + description: Sonarr 4K Exportarr has disappeared from Prometheus + service discovery. + summary: Exportarr is down. + expr: | + absent(up{job=~".*sonarr_4k.*"} == 1) + for: 5m + labels: + severity: critical + - alert: Sonarr4KDown + annotations: + description: Sonarr 4K service is down. + summary: Sonarr 4K is down. + expr: | + sonarr_4k_system_status{job=~".*sonarr_4k.*"} == 0 + for: 5m + labels: + severity: critical diff --git a/clusters/cl01tl/applications/sonarr-4k/templates/replication-source.yaml b/clusters/cl01tl/applications/sonarr-4k/templates/replication-source.yaml new file mode 100644 index 000000000..e2b4cc656 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/templates/replication-source.yaml @@ -0,0 +1,35 @@ +# apiVersion: volsync.backube/v1alpha1 +# kind: ReplicationSource +# metadata: +# name: sonarr-4k-config-backup-source +# namespace: {{ .Release.Namespace }} +# labels: +# app.kubernetes.io/name: sonarr-4k-config-backup-source +# app.kubernetes.io/instance: {{ .Release.Name }} +# app.kubernetes.io/version: {{ .Chart.AppVersion }} +# app.kubernetes.io/component: backup +# app.kubernetes.io/part-of: {{ .Release.Name }} +# spec: +# sourcePVC: sonarr-4k-config +# trigger: +# schedule: 0 0 */3 * * +# restic: +# pruneIntervalDays: 14 +# repository: sonarr-4k-config-backup-secret +# retain: +# hourly: 1 +# daily: 1 +# weekly: 1 +# monthly: 2 +# yearly: 4 +# moverSecurityContext: +# fsGroup: 1000 +# fsGroupChangePolicy: OnRootMismatch +# supplementalGroups: +# - 44 +# - 100 +# - 109 +# - 65539 +# copyMethod: Snapshot +# storageClassName: ceph-block +# volumeSnapshotClassName: ceph-blockpool-snapshot diff --git a/clusters/cl01tl/applications/sonarr-4k/templates/service-monitor.yaml b/clusters/cl01tl/applications/sonarr-4k/templates/service-monitor.yaml new file mode 100644 index 000000000..133e30eab --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/templates/service-monitor.yaml @@ -0,0 +1,21 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: sonarr-4k + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-4k + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: sonarr-4k + app.kubernetes.io/instance: {{ .Release.Name }} + endpoints: + - port: metrics + interval: 3m + scrapeTimeout: 1m + path: /metrics diff --git a/clusters/cl01tl/applications/sonarr-4k/values.yaml b/clusters/cl01tl/applications/sonarr-4k/values.yaml new file mode 100644 index 000000000..b717264c8 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-4k/values.yaml @@ -0,0 +1,135 @@ +sonarr-4k: + controllers: + main: + type: deployment + replicas: 1 + strategy: Recreate + revisionHistoryLimit: 3 + pod: + securityContext: + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch + supplementalGroups: + - 44 + - 100 + - 109 + - 65539 + containers: + main: + image: + repository: ghcr.io/linuxserver/sonarr + tag: 4.0.13@sha256:4dfedb2598dc6bd51c40f4ecea2631dbe367840678ab109cd968f821d81a5327 + pullPolicy: IfNotPresent + env: + - name: TZ + value: US/Central + - name: PUID + value: 1000 + - name: PGID + value: 1000 + probes: + liveness: + enabled: false + custom: true + spec: + exec: + command: + - /usr/bin/env + - bash + - -c + - curl --fail localhost:8989/api/v1/system/status?apiKey=`IFS=\> && while + read -d \< E C; do if [[ $E = "ApiKey" ]]; then echo $C; fi; done < /config/config.xml` + failureThreshold: 5 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 10 + resources: + requests: + cpu: 10m + memory: 256Mi + metrics: + image: + repository: ghcr.io/onedr0p/exportarr + tag: v2.0.1 + pullPolicy: IfNotPresent + args: ["sonarr"] + env: + - name: URL + value: http://localhost + - name: CONFIG + value: /config/config.xml + - name: PORT + value: 9794 + - name: ENABLE_ADDITIONAL_METRICS + value: false + - name: ENABLE_UNKNOWN_QUEUE_ITEMS + value: false + resources: + requests: + cpu: 100m + memory: 256Mi + serviceAccount: + create: true + service: + main: + controller: main + ports: + http: + port: 80 + targetPort: 8989 + protocol: HTTP + metrics: + port: 9794 + targetPort: 9794 + protocol: TCP + persistence: + config: + storageClass: ceph-block + accessMode: ReadWriteOnce + size: 20Gi + retain: true + advancedMounts: + main: + main: + - path: /config + readOnly: false + metrics: + - path: /config + readOnly: true + media: + existingClaim: sonarr-4k-nfs-storage + advancedMounts: + main: + main: + - path: /mnt/store + readOnly: false +postgres-17-cluster: + nameOverride: sonarr4-postgresql-17 + mode: recovery + cluster: + walStorage: + storageClass: local-path + storage: + storageClass: local-path + monitoring: + enabled: true + bootstrap: + initdb: + database: app + owner: app + postInitSQL: + - CREATE DATABASE "sonarr-main" OWNER "app"; + - CREATE DATABASE "sonarr-log" OWNER "app"; + recovery: + endpointURL: https://nyc3.digitaloceanspaces.com + destinationPath: s3://postgres-backups-ce540ddf106d186bbddca68a/cl01tl/sonarr4-4k/sonarr4-4k-postgresql-17-cluster + endpointCredentials: sonarr-4k-postgresql-17-cluster-backup-secret + recoveryIndex: 2 + backup: + enabled: false + endpointURL: https://nyc3.digitaloceanspaces.com + destinationPath: s3://postgres-backups-ce540ddf106d186bbddca68a/cl01tl/sonarr4-4k/sonarr4-4k-postgresql-17-cluster + endpointCredentials: sonarr-4k-postgresql-17-cluster-backup-secret + backupIndex: 3 + retentionPolicy: "7d" diff --git a/clusters/cl01tl/applications/sonarr-anime/Chart.yaml b/clusters/cl01tl/applications/sonarr-anime/Chart.yaml new file mode 100644 index 000000000..0cac9228b --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/Chart.yaml @@ -0,0 +1,30 @@ +apiVersion: v2 +name: sonarr-anime +version: 1.0.0 +description: Sonarr v4 Anime +keywords: + - sonarr + - servarr + - anime + - metrics +home: https://wiki.alexlebens.dev/doc/sonarr-AvJLY9PxEy +sources: + - https://github.com/Sonarr/Sonarr + - https://github.com/cloudnative-pg/cloudnative-pg + - https://github.com/onedr0p/containers/pkgs/container/sonarr + - https://github.com/onedr0p/exportarr/pkgs/container/exportarr + - https://github.com/bjw-s/helm-charts/tree/main/charts/other/app-template + - https://github.com/alexlebens/helm-charts/charts/postgres-cluster +maintainers: + - name: alexlebens +dependencies: + - name: app-template + alias: sonarr-anime + repository: https://bjw-s.github.io/helm-charts/ + version: 3.7.1 + - name: postgres-cluster + alias: postgres-17-cluster + version: 4.2.0 + repository: http://alexlebens.github.io/helm-charts +icon: https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/png/sonarr.png +appVersion: 4.0.11 diff --git a/clusters/cl01tl/applications/sonarr-anime/templates/external-secret.yaml b/clusters/cl01tl/applications/sonarr-anime/templates/external-secret.yaml new file mode 100644 index 000000000..1b8cc34c0 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/templates/external-secret.yaml @@ -0,0 +1,89 @@ +# apiVersion: external-secrets.io/v1beta1 +# kind: ExternalSecret +# metadata: +# name: sonarr-anime-config-backup-secret +# namespace: {{ .Release.Namespace }} +# labels: +# app.kubernetes.io/name: sonarr-anime-config-backup-secret +# app.kubernetes.io/instance: {{ .Release.Name }} +# app.kubernetes.io/version: {{ .Chart.AppVersion }} +# app.kubernetes.io/component: backup +# app.kubernetes.io/part-of: {{ .Release.Name }} +# spec: +# secretStoreRef: +# kind: ClusterSecretStore +# name: vault +# target: +# template: +# mergePolicy: Merge +# engineVersion: v2 +# data: +# RESTIC_REPOSITORY: "{{ `{{ .BUCKET_ENDPOINT }}` }}/sonarr4-anime/sonarr4-anime-config" +# data: +# - secretKey: BUCKET_ENDPOINT +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: S3_BUCKET_ENDPOINT +# - secretKey: RESTIC_PASSWORD +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: RESTIC_PASSWORD +# - secretKey: AWS_DEFAULT_REGION +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: AWS_DEFAULT_REGION +# - secretKey: AWS_ACCESS_KEY_ID +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /digital-ocean/home-infra/volsync-backups +# metadataPolicy: None +# property: access_key +# - secretKey: AWS_SECRET_ACCESS_KEY +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /digital-ocean/home-infra/volsync-backups +# metadataPolicy: None +# property: secret_key + +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: sonarr-anime-postgresql-17-cluster-backup-secret + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-anime-postgresql-17-cluster-backup-secret + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: database + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + data: + - secretKey: ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/postgres-backups + metadataPolicy: None + property: access + - secretKey: ACCESS_SECRET_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/postgres-backups + metadataPolicy: None + property: secret diff --git a/clusters/cl01tl/applications/sonarr-anime/templates/http-route.yaml b/clusters/cl01tl/applications/sonarr-anime/templates/http-route.yaml new file mode 100644 index 000000000..f662a2a7a --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/templates/http-route.yaml @@ -0,0 +1,30 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: http-route-sonarr-anime + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: http-route-sonarr-anime + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + parentRefs: + - group: gateway.networking.k8s.io + kind: Gateway + name: traefik-gateway + namespace: traefik + hostnames: + - sonarr-anime.alexlebens.net + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - group: '' + kind: Service + name: sonarr-anime + port: 80 + weight: 100 diff --git a/clusters/cl01tl/applications/sonarr-anime/templates/persistent-volume-claim.yaml b/clusters/cl01tl/applications/sonarr-anime/templates/persistent-volume-claim.yaml new file mode 100644 index 000000000..aac0c2304 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/templates/persistent-volume-claim.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: sonarr-anime-nfs-storage + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-anime-nfs-storage + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: storage + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + volumeName: sonarr-anime-nfs-storage + storageClassName: nfs-client + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Gi diff --git a/clusters/cl01tl/applications/sonarr-anime/templates/persistent-volume.yaml b/clusters/cl01tl/applications/sonarr-anime/templates/persistent-volume.yaml new file mode 100644 index 000000000..dd526175b --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/templates/persistent-volume.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: sonarr-anime-nfs-storage + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-anime-nfs-storage + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: storage + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + persistentVolumeReclaimPolicy: Retain + storageClassName: nfs-client + capacity: + storage: 1Gi + accessModes: + - ReadWriteMany + nfs: + path: /volume2/Storage + server: synologybond.alexlebens.net + mountOptions: + - vers=4 + - minorversion=1 + - noac diff --git a/clusters/cl01tl/applications/sonarr-anime/templates/prometheus-rule.yaml b/clusters/cl01tl/applications/sonarr-anime/templates/prometheus-rule.yaml new file mode 100644 index 000000000..9e1b2e3b4 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/templates/prometheus-rule.yaml @@ -0,0 +1,34 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: sonarr-anime + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-anime + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + groups: + - name: sonarr-anime + rules: + - alert: ExportarrAbsent + annotations: + description: Sonarr Anime Exportarr has disappeared from Prometheus + service discovery. + summary: Exportarr is down. + expr: | + absent(up{job=~".*sonarr_anime.*"} == 1) + for: 5m + labels: + severity: critical + - alert: SonarrAnimeDown + annotations: + description: Sonarr Anime service is down. + summary: Sonarr Anime is down. + expr: | + sonarr_anime_system_status{job=~".*sonarr_anime.*"} == 0 + for: 5m + labels: + severity: critical diff --git a/clusters/cl01tl/applications/sonarr-anime/templates/replication-source.yaml b/clusters/cl01tl/applications/sonarr-anime/templates/replication-source.yaml new file mode 100644 index 000000000..cb580244d --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/templates/replication-source.yaml @@ -0,0 +1,35 @@ +# apiVersion: volsync.backube/v1alpha1 +# kind: ReplicationSource +# metadata: +# name: sonarr-anime-config-backup-source +# namespace: {{ .Release.Namespace }} +# labels: +# app.kubernetes.io/name: sonarr-anime-config-backup-source +# app.kubernetes.io/instance: {{ .Release.Name }} +# app.kubernetes.io/version: {{ .Chart.AppVersion }} +# app.kubernetes.io/component: backup +# app.kubernetes.io/part-of: {{ .Release.Name }} +# spec: +# sourcePVC: sonarr-anime-config +# trigger: +# schedule: 0 0 */3 * * +# restic: +# pruneIntervalDays: 14 +# repository: sonarr-anime-config-backup-secret +# retain: +# hourly: 1 +# daily: 1 +# weekly: 1 +# monthly: 2 +# yearly: 4 +# moverSecurityContext: +# fsGroup: 1000 +# fsGroupChangePolicy: OnRootMismatch +# supplementalGroups: +# - 44 +# - 100 +# - 109 +# - 65539 +# copyMethod: Snapshot +# storageClassName: ceph-block +# volumeSnapshotClassName: ceph-blockpool-snapshot diff --git a/clusters/cl01tl/applications/sonarr-anime/templates/service-monitor.yaml b/clusters/cl01tl/applications/sonarr-anime/templates/service-monitor.yaml new file mode 100644 index 000000000..f612bf8b3 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/templates/service-monitor.yaml @@ -0,0 +1,21 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: sonarr-anime + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-anime + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: sonarr-anime + app.kubernetes.io/instance: {{ .Release.Name }} + endpoints: + - port: metrics + interval: 3m + scrapeTimeout: 1m + path: /metrics diff --git a/clusters/cl01tl/applications/sonarr-anime/values.yaml b/clusters/cl01tl/applications/sonarr-anime/values.yaml new file mode 100644 index 000000000..71464a356 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr-anime/values.yaml @@ -0,0 +1,135 @@ +sonarr-anime: + controllers: + main: + type: deployment + replicas: 1 + strategy: Recreate + revisionHistoryLimit: 3 + pod: + securityContext: + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch + supplementalGroups: + - 44 + - 100 + - 109 + - 65539 + containers: + main: + image: + repository: ghcr.io/linuxserver/sonarr + tag: 4.0.13@sha256:4dfedb2598dc6bd51c40f4ecea2631dbe367840678ab109cd968f821d81a5327 + pullPolicy: IfNotPresent + env: + - name: TZ + value: US/Central + - name: PUID + value: 1000 + - name: PGID + value: 1000 + probes: + liveness: + enabled: false + custom: true + spec: + exec: + command: + - /usr/bin/env + - bash + - -c + - curl --fail localhost:8989/api/v1/system/status?apiKey=`IFS=\> && while + read -d \< E C; do if [[ $E = "ApiKey" ]]; then echo $C; fi; done < /config/config.xml` + failureThreshold: 5 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 10 + resources: + requests: + cpu: 10m + memory: 256Mi + metrics: + image: + repository: ghcr.io/onedr0p/exportarr + tag: v2.0.1 + pullPolicy: IfNotPresent + args: ["sonarr"] + env: + - name: URL + value: http://localhost + - name: CONFIG + value: /config/config.xml + - name: PORT + value: 9794 + - name: ENABLE_ADDITIONAL_METRICS + value: false + - name: ENABLE_UNKNOWN_QUEUE_ITEMS + value: false + resources: + requests: + cpu: 100m + memory: 256Mi + serviceAccount: + create: true + service: + main: + controller: main + ports: + http: + port: 80 + targetPort: 8989 + protocol: HTTP + metrics: + port: 9794 + targetPort: 9794 + protocol: TCP + persistence: + config: + storageClass: ceph-block + accessMode: ReadWriteOnce + size: 20Gi + retain: true + advancedMounts: + main: + main: + - path: /config + readOnly: false + metrics: + - path: /config + readOnly: true + media: + existingClaim: sonarr-anime-nfs-storage + advancedMounts: + main: + main: + - path: /mnt/store + readOnly: false +postgres-17-cluster: + nameOverride: sonarr4-postgresql-17 + mode: recovery + cluster: + walStorage: + storageClass: local-path + storage: + storageClass: local-path + monitoring: + enabled: true + bootstrap: + initdb: + database: app + owner: app + postInitSQL: + - CREATE DATABASE "sonarr-main" OWNER "app"; + - CREATE DATABASE "sonarr-log" OWNER "app"; + recovery: + endpointURL: https://nyc3.digitaloceanspaces.com + destinationPath: s3://postgres-backups-ce540ddf106d186bbddca68a/cl01tl/sonarr4-anime/sonarr4-anime-postgresql-17-cluster + endpointCredentials: sonarr-anime-postgresql-17-cluster-backup-secret + recoveryIndex: 2 + backup: + enabled: false + endpointURL: https://nyc3.digitaloceanspaces.com + destinationPath: s3://postgres-backups-ce540ddf106d186bbddca68a/cl01tl/sonarr4-anime/sonarr4-anime-postgresql-17-cluster + endpointCredentials: sonarr-anime-postgresql-17-cluster-backup-secret + backupIndex: 3 + retentionPolicy: "7d" diff --git a/clusters/cl01tl/applications/sonarr/Chart.yaml b/clusters/cl01tl/applications/sonarr/Chart.yaml new file mode 100644 index 000000000..9fa6e170c --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/Chart.yaml @@ -0,0 +1,30 @@ +apiVersion: v2 +name: sonarr +version: 1.0.0 +description: Sonarr v4 +keywords: + - sonarr + - servarr + - tv shows + - metrics +home: https://wiki.alexlebens.dev/doc/sonarr-AvJLY9PxEy +sources: + - https://github.com/Sonarr/Sonarr + - https://github.com/cloudnative-pg/cloudnative-pg + - https://github.com/onedr0p/containers/pkgs/container/sonarr + - https://github.com/onedr0p/exportarr/pkgs/container/exportarr + - https://github.com/bjw-s/helm-charts/tree/main/charts/other/app-template + - https://github.com/alexlebens/helm-charts/charts/postgres-cluster +maintainers: + - name: alexlebens +dependencies: + - name: app-template + alias: sonarr + repository: https://bjw-s.github.io/helm-charts/ + version: 3.7.1 + - name: postgres-cluster + alias: postgres-17-cluster + version: 4.2.0 + repository: http://alexlebens.github.io/helm-charts +icon: https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/png/sonarr.png +appVersion: 4.0.11.2680 diff --git a/clusters/cl01tl/applications/sonarr/templates/external-secret.yaml b/clusters/cl01tl/applications/sonarr/templates/external-secret.yaml new file mode 100644 index 000000000..ddb5d4fee --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/templates/external-secret.yaml @@ -0,0 +1,89 @@ +# apiVersion: external-secrets.io/v1beta1 +# kind: ExternalSecret +# metadata: +# name: sonarr-config-backup-secret +# namespace: {{ .Release.Namespace }} +# labels: +# app.kubernetes.io/name: sonarr-config-backup-secret +# app.kubernetes.io/instance: {{ .Release.Name }} +# app.kubernetes.io/version: {{ .Chart.AppVersion }} +# app.kubernetes.io/component: backup +# app.kubernetes.io/part-of: {{ .Release.Name }} +# spec: +# secretStoreRef: +# kind: ClusterSecretStore +# name: vault +# target: +# template: +# mergePolicy: Merge +# engineVersion: v2 +# data: +# RESTIC_REPOSITORY: "{{ `{{ .BUCKET_ENDPOINT }}` }}/sonarr4/sonarr4-config" +# data: +# - secretKey: BUCKET_ENDPOINT +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: S3_BUCKET_ENDPOINT +# - secretKey: RESTIC_PASSWORD +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: RESTIC_PASSWORD +# - secretKey: AWS_DEFAULT_REGION +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /cl01tl/volsync/restic/config +# metadataPolicy: None +# property: AWS_DEFAULT_REGION +# - secretKey: AWS_ACCESS_KEY_ID +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /digital-ocean/home-infra/volsync-backups +# metadataPolicy: None +# property: access_key +# - secretKey: AWS_SECRET_ACCESS_KEY +# remoteRef: +# conversionStrategy: Default +# decodingStrategy: None +# key: /digital-ocean/home-infra/volsync-backups +# metadataPolicy: None +# property: secret_key + +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: sonarr-postgresql-17-cluster-backup-secret + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-postgresql-17-cluster-backup-secret + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: database + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + data: + - secretKey: ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/postgres-backups + metadataPolicy: None + property: access + - secretKey: ACCESS_SECRET_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/postgres-backups + metadataPolicy: None + property: secret diff --git a/clusters/cl01tl/applications/sonarr/templates/http-route.yaml b/clusters/cl01tl/applications/sonarr/templates/http-route.yaml new file mode 100644 index 000000000..73cf6ebba --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/templates/http-route.yaml @@ -0,0 +1,30 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: http-route-sonarr + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: http-route-sonarr + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + parentRefs: + - group: gateway.networking.k8s.io + kind: Gateway + name: traefik-gateway + namespace: traefik + hostnames: + - sonarr.alexlebens.net + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - group: '' + kind: Service + name: sonarr + port: 80 + weight: 100 diff --git a/clusters/cl01tl/applications/sonarr/templates/persistent-volume-claim.yaml b/clusters/cl01tl/applications/sonarr/templates/persistent-volume-claim.yaml new file mode 100644 index 000000000..7dff0c442 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/templates/persistent-volume-claim.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: sonarr-nfs-storage + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-nfs-storage + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: storage + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + volumeName: sonarr-nfs-storage + storageClassName: nfs-client + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Gi diff --git a/clusters/cl01tl/applications/sonarr/templates/persistent-volume.yaml b/clusters/cl01tl/applications/sonarr/templates/persistent-volume.yaml new file mode 100644 index 000000000..b1feb6944 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/templates/persistent-volume.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: sonarr-nfs-storage + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr-nfs-storage + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: storage + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + persistentVolumeReclaimPolicy: Retain + storageClassName: nfs-client + capacity: + storage: 1Gi + accessModes: + - ReadWriteMany + nfs: + path: /volume2/Storage + server: synologybond.alexlebens.net + mountOptions: + - vers=4 + - minorversion=1 + - noac diff --git a/clusters/cl01tl/applications/sonarr/templates/prometheus-rule.yaml b/clusters/cl01tl/applications/sonarr/templates/prometheus-rule.yaml new file mode 100644 index 000000000..92f4f8ba9 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/templates/prometheus-rule.yaml @@ -0,0 +1,34 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: sonarr + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + groups: + - name: sonarr + rules: + - alert: ExportarrAbsent + annotations: + description: Sonarr Exportarr has disappeared from Prometheus + service discovery. + summary: Exportarr is down. + expr: | + absent(up{job=~".*sonarr.*"} == 1) + for: 5m + labels: + severity: critical + - alert: SonarrDown + annotations: + description: Sonarr service is down. + summary: Sonarr is down. + expr: | + sonarr_system_status{job=~".*sonarr.*"} == 0 + for: 5m + labels: + severity: critical diff --git a/clusters/cl01tl/applications/sonarr/templates/replication-source.yaml b/clusters/cl01tl/applications/sonarr/templates/replication-source.yaml new file mode 100644 index 000000000..189c39e75 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/templates/replication-source.yaml @@ -0,0 +1,35 @@ +# apiVersion: volsync.backube/v1alpha1 +# kind: ReplicationSource +# metadata: +# name: sonarr-config-backup-source +# namespace: {{ .Release.Namespace }} +# labels: +# app.kubernetes.io/name: sonarr-config-backup-source +# app.kubernetes.io/instance: {{ .Release.Name }} +# app.kubernetes.io/version: {{ .Chart.AppVersion }} +# app.kubernetes.io/component: backup +# app.kubernetes.io/part-of: {{ .Release.Name }} +# spec: +# sourcePVC: sonarr-config +# trigger: +# schedule: 0 0 */3 * * +# restic: +# pruneIntervalDays: 14 +# repository: sonarr-config-backup-secret +# retain: +# hourly: 1 +# daily: 1 +# weekly: 1 +# monthly: 2 +# yearly: 4 +# moverSecurityContext: +# fsGroup: 1000 +# fsGroupChangePolicy: OnRootMismatch +# supplementalGroups: +# - 44 +# - 100 +# - 109 +# - 65539 +# copyMethod: Snapshot +# storageClassName: ceph-block +# volumeSnapshotClassName: ceph-blockpool-snapshot diff --git a/clusters/cl01tl/applications/sonarr/templates/service-monitor.yaml b/clusters/cl01tl/applications/sonarr/templates/service-monitor.yaml new file mode 100644 index 000000000..ab3a0fe3b --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/templates/service-monitor.yaml @@ -0,0 +1,21 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: sonarr + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: sonarr + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: sonarr + app.kubernetes.io/instance: {{ .Release.Name }} + endpoints: + - port: metrics + interval: 3m + scrapeTimeout: 1m + path: /metrics diff --git a/clusters/cl01tl/applications/sonarr/values.yaml b/clusters/cl01tl/applications/sonarr/values.yaml new file mode 100644 index 000000000..1483c8bb8 --- /dev/null +++ b/clusters/cl01tl/applications/sonarr/values.yaml @@ -0,0 +1,138 @@ +sonarr: + controllers: + main: + type: deployment + replicas: 1 + strategy: Recreate + revisionHistoryLimit: 3 + pod: + securityContext: + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch + supplementalGroups: + - 44 + - 100 + - 109 + - 65539 + containers: + main: + image: + repository: ghcr.io/linuxserver/sonarr + tag: 4.0.13@sha256:4dfedb2598dc6bd51c40f4ecea2631dbe367840678ab109cd968f821d81a5327 + pullPolicy: IfNotPresent + env: + - name: TZ + value: US/Central + - name: PUID + value: 1000 + - name: PGID + value: 1000 + probes: + liveness: + enabled: false + custom: true + spec: + exec: + command: + - /usr/bin/env + - bash + - -c + - curl --fail localhost:8989/api/v1/system/status?apiKey=`IFS=\> && while + read -d \< E C; do if [[ $E = "ApiKey" ]]; then echo $C; fi; done < /config/config.xml` + failureThreshold: 5 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 10 + resources: + requests: + cpu: 100m + memory: 256Mi + metrics: + image: + repository: ghcr.io/onedr0p/exportarr + tag: v2.0.1 + pullPolicy: IfNotPresent + args: ["sonarr"] + env: + - name: URL + value: http://localhost + - name: CONFIG + value: /config/config.xml + - name: PORT + value: 9794 + - name: ENABLE_ADDITIONAL_METRICS + value: false + - name: ENABLE_UNKNOWN_QUEUE_ITEMS + value: false + resources: + requests: + cpu: 100m + memory: 256Mi + serviceAccount: + create: true + service: + main: + controller: main + ports: + http: + port: 80 + targetPort: 8989 + protocol: HTTP + metrics: + port: 9794 + targetPort: 9794 + protocol: TCP + persistence: + config: + storageClass: ceph-block + accessMode: ReadWriteOnce + size: 20Gi + retain: true + advancedMounts: + main: + main: + - path: /config + readOnly: false + metrics: + - path: /config + readOnly: true + media: + existingClaim: sonarr-nfs-storage + advancedMounts: + main: + main: + - path: /mnt/store + readOnly: false +postgres-17-cluster: + nameOverride: sonarr4-postgresql-17 + mode: recovery + cluster: + walStorage: + storageClass: local-path + storage: + storageClass: local-path + resources: + requests: + memory: 512Mi + monitoring: + enabled: true + bootstrap: + initdb: + database: app + owner: app + postInitSQL: + - CREATE DATABASE "sonarr-main" OWNER "app"; + - CREATE DATABASE "sonarr-log" OWNER "app"; + recovery: + endpointURL: https://nyc3.digitaloceanspaces.com + destinationPath: s3://postgres-backups-ce540ddf106d186bbddca68a/cl01tl/sonarr4/sonarr4-postgresql-17-cluster + endpointCredentials: sonarr-postgresql-17-cluster-backup-secret + recoveryIndex: 2 + backup: + enabled: false + endpointURL: https://nyc3.digitaloceanspaces.com + destinationPath: s3://postgres-backups-ce540ddf106d186bbddca68a/cl01tl/sonarr4/sonarr4-postgresql-17-cluster + endpointCredentials: sonarr-postgresql-17-cluster-backup-secret + backupIndex: 3 + retentionPolicy: "7d"