apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: lemur
  name: lemur
  labels:
    app: lemur
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lemur
  template:
    metadata:
      labels:
        app: lemur
    spec:
      serviceAccount: lemur
      containers:
        - name: lemur
          image: quay.io/wfhartford/lemur-web:latest
          env:
            - name: POSTGRES_HOST
              value: postgres
            - name: LEMUR_CONF
              value: /usr/local/src/lemur/lemur.conf.py
            - name: SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: lemur
                  key: flask-secret-key
            - name: LEMUR_TOKEN_SECRET
              valueFrom:
                secretKeyRef:
                  name: lemur
                  key: lemur-token-secret
            - name: LEMUR_ENCRYPTION_KEYS
              valueFrom:
                secretKeyRef:
                  name: lemur
                  key: lemur-encryption-keys
            - name: LEMUR_DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: lemur
                  key: database-password
            # POSTGRES_PASSWORD only required on first startup to create lemur DB
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: init
                  key: postgres-password
                  optional: true
            # LEMUR_PASSWORD is only required on first startup to create lemur user
            - name: LEMUR_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: init
                  key: lemur-password
                  optional: true
          ports:
            - name: http
              containerPort: 8000
          resources:
            limits:
              memory: 1Gi
              cpu: 1
            requests:
              memory: 100Mi
              cpu: 500m
#          livenessProbe:
#            httpGet:
#              path: /
#              port: http
#            initialDelaySeconds: 30
#            timeoutSeconds: 1
#            periodSeconds: 5
          volumeMounts:
            - name: config
              mountPath: /lemur-config
              readOnly: true
      volumes:
        - name: config
          configMap:
            name: lemur
