apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: feed
  name: feed
spec:
  replicas: 2 # demo uses 3
  selector:
    matchLabels:
      name: feed
  template:
    metadata:
      labels:
        name: feed
        service: feed
        version: v3
    spec:
      containers:
      - image: dsalazar10/udagram:feed
        name: feed
        imagePullPolicy: Always  
        # resources:
        #   requests:
        #     memory: "64Mi"
        #     cpu: "250m"
        #   limits:
        #     memory: "1024Mi"
        #     cpu: "500m"                  
        env:
        - name: URL
          valueFrom:
            configMapKeyRef:
              name: env-config
              key: URL
        - name: AWS_BUCKET
          valueFrom:
            configMapKeyRef:
              name: env-config
              key: AWS_BUCKET
        - name: AWS_PROFILE
          valueFrom:
            configMapKeyRef:
              name: env-config
              key: AWS_PROFILE
        - name: AWS_REGION
          valueFrom:
            configMapKeyRef:
              name: env-config
              key: AWS_REGION
        - name: JWT_SECRET
          valueFrom:
            configMapKeyRef:
              name: env-config
              key: JWT_SECRET
        - name: POSTGRESS_DB
          valueFrom:
            configMapKeyRef:
              name: env-config
              key: POSTGRESS_DB
        - name: POSTGRESS_HOST
          valueFrom:
            configMapKeyRef:
              name: env-config
              key: POSTGRESS_HOST
        - name: POSTGRESS_PASSWORD
          valueFrom:
            secretKeyRef:
              name: env-secret
              key: POSTGRESS_PASSWORD
        - name: POSTGRESS_USERNAME
          valueFrom:
            secretKeyRef:
              name: env-secret
              key: POSTGRESS_USERNAME      
        volumeMounts:
        - name: aws-secret
          mountPath: "/root/.aws/"
          readOnly: true        
      restartPolicy: Always
      volumes:
      - name: aws-secret
        secret:
          secretName: aws-secret       