apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: app-date-todos
  name: app-date-todos-old
spec:
  replicas: 1
  selector:
    matchLabels:
      service: app-date-todos
  template:
    metadata:
      labels:
        service: app-date-todos
    spec:
      containers:
      - image: lomuga/app-date-todos:v1
        name: uapp-date-todos-old
        imagePullPolicy: Always
        ports:
        - containerPort: 81        
        resources:
          requests:
            memory: "512Mi"
            cpu: "250m"
          limits:
            memory: "1024Mi"
            cpu: "500m"
        env:
        #- name: URL
         # valueFrom:
         #   configMapKeyRef:
          #    name: env-config
          #    key: URL
        - 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
        volumeMounts:
          - name: aws-secret
            mountPath: "/root/.aws/"
            readOnly: true
      imagePullSecrets:
        - name: regcred
      restartPolicy: Always  
      volumes:
      - name: aws-secret
        secret:
          secretName: aws-secret

# For Kubernetes to know the docker secret https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#registry-secret-existing-credentials