apiVersion: apps/v1
kind: Deployment
metadata:
  name: flask-dep
  labels:
    app: flask-helloworld
spec:
  replicas: 2
  selector:
    matchLabels:
      app: flask-helloworld
  template:
    metadata:
      labels:
        app: flask-helloworld
    spec:
      containers:
      - name: flask
        image: jamonation/flask-helloworld:latest
        ports:
        - containerPort: 5000
        env:
          - name: DB_HOST
            valueFrom:
              secretKeyRef:
                name: postgres-secrets
                key: host
          - name: DB_NAME
            valueFrom:
              secretKeyRef:
                name: postgres-secrets
                key: name
          - name: DB_PASS
            valueFrom:
              secretKeyRef:
                name: postgres-secrets
                key: pass
          - name: DB_PORT
            valueFrom:
              secretKeyRef:
                name: postgres-secrets
                key: port
          - name: DB_USER
            valueFrom:
              secretKeyRef:
                name: postgres-secrets
                key: user
          - name: REDIS_HOST
            valueFrom:
              configMapKeyRef:
                name: redis-config
                key: host
          - name: REDIS_PORT
            valueFrom:
              configMapKeyRef:
                name: redis-config
                key: port
