apiVersion: apps/v1
kind: Deployment
metadata:
  name: peercalls
spec:
  progressDeadlineSeconds: 120
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
  replicas: 2
  selector:
    matchLabels:
      app.kubernetes.io/name: peercalls
  template:
    metadata:
      labels:
        app.kubernetes.io/name: peercalls
    spec:
      volumes:
      - name: config-volume
        configMap:
          name: peercalls-config
      containers:
      - name: peercalls
        image: peercalls/peercalls
        imagePullPolicy: IfNotPresent
        command: ["peer-calls", "-c", "/etc/peercalls/config.yaml"]
        ports:
        - name: http
          containerPort: 3000
          protocol: TCP
        livenessProbe:
          httpGet:
            path: /probes/liveness
            port: http
          initialDelaySeconds: 5
          periodSeconds: 15
          timeoutSeconds: 5
        readinessProbe:
          httpGet:
            path: /probes/health
            port: http
          initialDelaySeconds: 5
          timeoutSeconds: 1
        resources:
          limits:
            cpu: 1000m
            memory: 1Gi
          requests:
            cpu: 100m
            memory: 128Mi
        volumeMounts:
        - name: config-volume
          mountPath: /etc/peercalls
        securityContext:
          runAsNonRoot: true
          runAsUser: 1000
        lifecycle:
          preStop:
            exec:
              command:
              - sleep
              - "10"
      serviceAccountName: peercalls
      securityContext:
        fsGroup: 1000
