summaryrefslogtreecommitdiff
path: root/f3s/navidrome/helm-chart/templates/deployment.yaml
blob: 53964cf53ce7f01b3c8d12b0aaec7ac1b8a6dddb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
apiVersion: apps/v1
kind: Deployment
metadata:
  name: navidrome
  namespace: services
spec:
  replicas: 1
  # SQLite DB on RWO PVC: only one writer at a time. Use Recreate so the
  # old pod releases the DB lock before the new pod starts; otherwise the
  # new pod blocks indefinitely on the SQLite open.
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: navidrome
  template:
    metadata:
      labels:
        app: navidrome
    spec:
      initContainers:
      - name: nfs-check-music
        image: busybox:stable
        command:
        - sh
        - -c
        - |
          test -f /mnt/.nfs-sentinel || (
            echo "ERROR: NFS sentinel missing at /mnt/.nfs-sentinel"
            echo "refusing to start; node likely has NFS unmounted"
            echo "pod would otherwise bind-mount the local-XFS shadow"
            exit 1
          )
        volumeMounts:
        - name: navidrome-music
          mountPath: /mnt
          readOnly: true
      # Pin to r1 so the local-path PVC (which lives on r1's disk at
      # /var/lib/rancher/k3s/storage) is always reachable. Without this, if
      # the pod reschedules to a different node it would not find the data
      # volume and Navidrome would start with an empty DB.
      nodeSelector:
        kubernetes.io/hostname: r1.lan.buetow.org
      containers:
      - name: navidrome
        image: deluan/navidrome:0.61.2
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 4533
        env:
        - name: ND_SCANSCHEDULE
          value: "1h"
        - name: ND_LOGLEVEL
          value: "info"
        - name: ND_BASEURL
          value: ""
        startupProbe:
          httpGet:
            path: /ping
            port: 4533
          # Allow up to 5 min for cold start (DB open, first scan, etc.)
          initialDelaySeconds: 15
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 60
        readinessProbe:
          httpGet:
            path: /ping
            port: 4533
          periodSeconds: 10
          timeoutSeconds: 3
          failureThreshold: 3
        livenessProbe:
          httpGet:
            path: /ping
            port: 4533
          periodSeconds: 30
          timeoutSeconds: 5
          failureThreshold: 5
        volumeMounts:
        - name: navidrome-data
          mountPath: /data
        - name: navidrome-music
          mountPath: /music
      volumes:
      - name: navidrome-data
        persistentVolumeClaim:
          claimName: navidrome-data-pvc
      - name: navidrome-music
        persistentVolumeClaim:
          claimName: navidrome-music-pvc
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: navidrome
  name: navidrome-service
  namespace: services
spec:
  ports:
    - name: web
      port: 4533
      protocol: TCP
      targetPort: 4533
  selector:
    app: navidrome