diff --git a/apps/sonarr.yaml b/apps/sonarr.yaml new file mode 100644 index 0000000..6897f33 --- /dev/null +++ b/apps/sonarr.yaml @@ -0,0 +1,25 @@ +# This ArgoCD application deploys sonarr to manage TV shows for the media library +# This application pulls its image from hotio as theyre generally light weight +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: sonarr + namespace: argocd +spec: + project: default + + source: + repoURL: https://tea.ahmza.com/ahmza.com/k8s-starter-pack.git + targetRevision: main + path: apps/sonarr + + destination: + server: https://kubernetes.default.svc + namespace: sonarr + + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/apps/sonarr/deployment.yaml b/apps/sonarr/deployment.yaml new file mode 100644 index 0000000..cd1b71b --- /dev/null +++ b/apps/sonarr/deployment.yaml @@ -0,0 +1,70 @@ +# bazarr image from hotio ghcr.io/hotio/sonarr +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sonarr + namespace: sonarr +spec: + # Not Critical Infra so a single pod is fine + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: sonarr + template: + metadata: + labels: + app: sonarr + spec: + containers: + - name: sonarr + image: ghcr.io/hotio/sonarr:release + imagePullPolicy: Always + env: + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: UMASK + value: "002" + - name: TZ + value: "Europe/London" + ports: + - name: http + containerPort: 8989 + protocol: TCP + volumeMounds: + - name: sonarr-config + mountPath: /config + # Mount each media directory directly instead of using subPath. + # The NFS export root is not listable by root-squashed clients, so + # kubelet cannot safely prepare subPath mounts from that root. + - name: tv + mountPath: /tv + - name: anime + mountPath: /anime + - name: torrents + mountPath: /torrents + - name: usenet + mountPath: /usenet + volumes: + - name: sonarr-config + persistentVolumeClaim: + claimName: sonarr-config + - name: tv + nfs: + server: nas.ahmza.com + path: /srv/media/TVShows + - name: anime + nfs: + server: nas.ahmza.com + path: /srv/media/Anime + - name: torrents + nfs: + server: nas.ahmza.com + path: /srv/media/torrents + - name: usenet + nfs: + server: nas.ahmza.com + path: /srv/media/usenet diff --git a/apps/sonarr/ingress.yaml b/apps/sonarr/ingress.yaml new file mode 100644 index 0000000..370f245 --- /dev/null +++ b/apps/sonarr/ingress.yaml @@ -0,0 +1,24 @@ +# routes for sonarr.ahmza.com through ingress-nginx (docs/11-ingress.md) +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: sonarr + namespace: sonarr + annotations: + cert-manager.io/cluster-issuer: letsencrypt-stating +spec: + tls: + - hosts: + - sonarr.ahmza.com + secretName: sonarr-tls + rules: + - host: sonarr.ahmza.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: sonarr + port: + number: 8989 diff --git a/apps/sonarr/namespace.yaml b/apps/sonarr/namespace.yaml new file mode 100644 index 0000000..3e78749 --- /dev/null +++ b/apps/sonarr/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: sonarr diff --git a/apps/sonarr/pvc.yaml b/apps/sonarr/pvc.yaml new file mode 100644 index 0000000..232de0d --- /dev/null +++ b/apps/sonarr/pvc.yaml @@ -0,0 +1,12 @@ +# create a longhorn pvc for sonarr's config, see (docs/06-longhorn.md) +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: sonarr-config + namespace: sonarr +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi diff --git a/apps/sonarr/service.yaml b/apps/sonarr/service.yaml new file mode 100644 index 0000000..604555d --- /dev/null +++ b/apps/sonarr/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: sonarr + namespace: sonarr +spec: + selector: + app: sonarr + ports: + - name: http + port: 8989 + targetPort: http