apiVersion: apps/v1
kind: Deployment
metadata:
  name: storageos-api-manager
spec:
  replicas: 2
  selector:
    matchLabels:
      app: storageos
      app.kubernetes.io/component: storageos-api-manager
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: storageos
        app.kubernetes.io/component: storageos-api-manager
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app.kubernetes.io/component: storageos-api-manager
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - args:
        - --enable-leader-election
        - --metrics-addr=:8080
        command:
        - /manager
        image: api-manager
        imagePullPolicy: IfNotPresent
        name: api-manager
        ports:
        - containerPort: 8080
          name: metrics
          protocol: TCP
        volumeMounts:
        - mountPath: /etc/storageos/secrets/api
          name: api-secret
      priorityClassName: system-cluster-critical
      restartPolicy: Always
      serviceAccountName: storageos-api-manager
      terminationGracePeriodSeconds: 30
      tolerations:
      - key: node.kubernetes.io/disk-pressure
        operator: Exists
      - effect: NoExecute
        key: node.kubernetes.io/not-ready
        operator: Exists
        tolerationSeconds: 30
      - effect: NoExecute
        key: node.kubernetes.io/unreachable
        operator: Exists
        tolerationSeconds: 30
      volumes:
      - name: api-secret
        secret:
          secretName: storageos-api
