summaryrefslogtreecommitdiff
path: root/f3s/ychat/helm-chart/templates/deployment.yaml
blob: 365588ebec3e7be0aba096748edc12964c88daa1 (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
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ychat
  namespace: services
spec:
  replicas: 1
  # Recreate: single-instance stateful-in-memory chat; avoid two pods racing
  # for the same Service while the old one drains its sessions.
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: ychat
  template:
    metadata:
      labels:
        app: ychat
    spec:
      initContainers:
        - name: nfs-check-data
          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: data
              mountPath: /mnt
              readOnly: true
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        runAsGroup: 1000
        fsGroup: 1000
      containers:
        - name: ychat
          # SQLite is now mandatory (see ychat/DOCKER.md); the image tag tracks
          # the ychat repo commit that build was cut from.
          image: registry.lan.buetow.org:30001/ychat:fac9995
          imagePullPolicy: IfNotPresent
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
            runAsGroup: 1000
          ports:
            - containerPort: 2000
              name: http
          # No liveness/readiness probes: yChat segfaults on an empty TCP
          # open+close (a TCP-socket probe would kill it). It serves real HTTP
          # requests fine, and kubelet restarts the pod if the process exits.
          resources:
            requests:
              memory: 32Mi
              cpu: 25m
            limits:
              memory: 128Mi
              cpu: 250m
          volumeMounts:
            - name: log
              mountPath: /app/log
            - name: tmp
              mountPath: /tmp
            - name: data
              mountPath: /app/data
      volumes:
        - name: log
          emptyDir: {}
        - name: tmp
          emptyDir: {}
        - name: data
          persistentVolumeClaim:
            claimName: ychat-data-pvc