apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: api
  template: 
    metadata:       
      labels:
        app: api
    spec:      
      containers:
      - name: api
        image: fabricioveronez/pedelogo-catalogo:v1.0.0
        ports:
        - containerPort: 80
        imagePullPolicy: IfNotPresent
        resources:
          requests:
              cpu: "200m"
              memory: "128Mi"
          limits:
              cpu: "200m"
              memory: "128Mi"      
        readinessProbe:
          httpGet:
            path: /health
            port: 80
            scheme: HTTP
          timeoutSeconds: 3
          failureThreshold: 3
          periodSeconds: 5
        livenessProbe:
          httpGet:
              path: /health
              port: 80
              scheme: HTTP
          timeoutSeconds: 3
          failureThreshold: 3
          periodSeconds: 5
        envFrom:
          - configMapRef:
              name: api-configmap
        env:
          - name: Mongo__User
            valueFrom:
              secretKeyRef:
                key: MONGO_INITDB_ROOT_USERNAME
                name: mongodb-secret
          - name: Mongo__Password
            valueFrom:
              secretKeyRef:
                key: MONGO_INITDB_ROOT_PASSWORD
                name: mongodb-secret
