---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: shiftr-user-deployment
  namespace: shiftr-prod
spec:
  selector:
      matchLabels:
        app: shiftr-user-app
  replicas: 1
  template:
    metadata:
      labels:
        app: shiftr-user-app
    spec:
      securityContext:
        runAsUser: 1000
      containers:
      - name: shiftr-user
        image: 572862620375.dkr.ecr.ca-central-1.amazonaws.com/shiftr_user:prod2
        resources:
          limits:
            memory: "512Mi"
            cpu: "500m" #NEED TO CHANGE BASED ON LOAD AND PERF TESTING
          requests:
            memory: "250Mi"
            cpu: "200m" #NEED TO CHANGE BASED ON LOAD AND PERF TESTING
        readinessProbe:
            httpGet:
              path: /healthCheck
              port: 2001
              scheme: HTTP
            initialDelaySeconds: 200
            timeoutSeconds: 30
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
        livenessProbe:
            httpGet:
              path: /healthCheck
              port: 2001
              scheme: HTTP
            initialDelaySeconds: 200
            timeoutSeconds: 10
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
        ports:
        - containerPort: 2001
        env:
          - name: DB_NAME
            valueFrom:
              secretKeyRef:
                name: shiftr-user-secret
                key: databasename
          - name: DB_USERNAME
            valueFrom:
              secretKeyRef:
                name: shiftr-user-secret
                key: databaseusername
          - name: DB_PASSWORD
            valueFrom:
              secretKeyRef:
                name: shiftr-user-secret
                key: databasepassword
        envFrom:
        - configMapRef:
            name: shiftr-user-configmap