---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wikijs-dp
  labels:
    component: wikijs
spec:
  replicas: 1
  selector:
    matchLabels:
      component: wikijs
  template:
    metadata:
      labels:
        component: wikijs
    spec:
      volumes:
        - name: wikijs-locale-files
          configMap:
            name: wikijs-locale-files
        - name: wikijs-config
          configMap:
            name: wikijs-config
      containers:
        - name: wikijs
          image: requarks/wiki:2.5
          volumeMounts:
            - name: wikijs-locale-files
              mountPath: /wiki/data/sideload/locales.json
              subPath: locales.json
            - name: wikijs-locale-files
              mountPath: /wiki/data/sideload/en.json
              subPath: en.json
            - name: wikijs-config
              mountPath: /wiki/config.yml
              subPath: config.yml
          env:
            - name: OFFLINE
              value: "false"
            - name: HA_ACTIVE
              value: "true"
            - name: DB_TYPE
              value: "postgres"
            - name: DB_HOST
              value: "wikijs-db-svc"
            - name: DB_PORT
              value: "5432"
            - name: DB_USER
              valueFrom:
                secretKeyRef:
                  name: wikijs-db-password
                  key: username
            - name: DB_PASS
              valueFrom:
                secretKeyRef:
                  name: wikijs-db-password
                  key: password
            - name: DB_NAME
              value: "wikijs"
          ports:
            - name: tcp-3000
              containerPort: 3000
              protocol: "TCP"
            - name: tcp-3443
              containerPort: 3443
              protocol: "TCP"
