apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: api
  name: api
spec:
  replicas: 5
  selector:
    matchLabels:
      app: api
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: api
    spec:
      containers:
      - image: ghcr.io/craftbyte/msi-go:v1
        env:
        - name: MONGO_URL
          value: mongodb://mongo-svc.todo.svc.cluster.local:27017/?replicaSet=mongo&authSource=admin
        - name: MONGO_USERNAME
          value: user
        - name: MONGO_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mongo-password
              key: password
        livenessProbe:
          httpGet:
            path: /api/ping
            port: 8080
          periodSeconds: 5
        readinessProbe:
          httpGet:
            path: /api/ping
            port: 8080
          periodSeconds: 5
        startupProbe:
          httpGet:
            path: /api/ping
            port: 8080
          failureThreshold: 30
          periodSeconds: 10
        name: api
      imagePullSecrets:
      - name: regcred
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
