---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: wikijs
  name: wikijs
spec:
  progressDeadlineSeconds: 30
  replicas: 1
  selector:
    matchLabels:
      run: wikijs
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        run: wikijs
    spec:
      containers:
      - image: requarks/wiki:2.5
        imagePullPolicy: Always
        name: wiki
        env:
          - name: DB_TYPE
            value: postgres
          - name: DB_HOST
            valueFrom:
              configMapKeyRef:
                name: wikijs-db-values
                key: postgresql-host
          - name: DB_PORT
            valueFrom:
              configMapKeyRef:
                name: wikijs-db-values
                key: postgresql-port
          - name: DB_NAME
            valueFrom:
              configMapKeyRef:
                name: wikijs-db-values
                key: postgresql-dbname
          - name: DB_USER
            valueFrom:
              configMapKeyRef:
                name: wikijs-db-values
                key: postgresql-dbuser
          - name: DB_PASS
            valueFrom:
              secretKeyRef:
                name: prod-db-secret
                key: password
        resources:
          limits:
            cpu: "1"
            memory: 160Mi
          requests:
            cpu: 500m
            memory: 96Mi
        livenessProbe:
          httpGet:
            path: /healthz
            port: http
        readinessProbe:
          httpGet:
            path: /healthz
            port: http
        ports:
        - name: http
          containerPort: 3000
          protocol: TCP
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      terminationGracePeriodSeconds: 3
