apiVersion: apps/v1
kind: Deployment

metadata:
  labels:
    app: api
  name: api

spec:
  replicas: 1
  selector:
    matchLabels:
      app: api
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: api
    spec:
      containers:
        - name: presidio
          image: mcr.microsoft.com/presidio-api:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
              protocol: TCP
              name: http
          envFrom:
            - configMapRef:
                name: api
            - configMapRef:
                name: common
            - configMapRef:
                name: redis-client
            - secretRef:
                name: api
            - secretRef:
                name: redis
          env:
            - name: PRESIDIO_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: WEB_PORT
              value: "8080"
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8080
              scheme: HTTP
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8080
              scheme: HTTP
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          resources: {}
      restartPolicy: Always
      serviceAccount: api
      serviceAccountName: api
