view deploy_files.yaml @ 28:1e058bea3ac2

crash better when mongo is unreachable
author drewp@bigasterisk.com
date Sat, 23 Mar 2024 16:11:10 -0700
parents 27a754f8e8f8
children
line wrap: on
line source

apiVersion: apps/v1
kind: Deployment
metadata:
  name: video-files
spec:
  replicas: 2
  selector:
    matchLabels:
      app: video-files
  template:
    metadata:
      labels:
        app: video-files
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8004"
    spec:
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: video-data
      containers:
        - name: files
          image: reg:5000/video_image
          # alternate: [ "webfsd", "-Fp", "9054", "-r", "/vids/" ]
          command:
            - pnpm
            - exec
            - node
            - ./serve-files.js
          ports:
            - containerPort: 8003
          volumeMounts:
            - { name: data, mountPath: /data }

        - name: api
          image: reg:5000/video_image
          command:
            - pdm
            - run
            - python
            - video.py
          ports:
            - containerPort: 8004
          volumeMounts:
            - { name: data, mountPath: /data }
          resources:
            requests:
              cpu: "2"

      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: "kubernetes.io/hostname"
                    operator: In
                    values: ["ditto"]
---
apiVersion: v1
kind: Service
metadata:
  name: video-files
spec:
  ports:
    - { port: 8003, targetPort: 8003, name: files }
    - { port: 8004, targetPort: 8004, name: api }
  selector:
    app: video-files