apiVersion: apps/v1
kind: Deployment
metadata:
  name: cluster-storage-operator
  namespace: openshift-cluster-storage-operator
  annotations:
    include.release.openshift.io/ibm-cloud-managed: "true"
    include.release.openshift.io/self-managed-high-availability: "true"
    include.release.openshift.io/single-node-developer: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      name: cluster-storage-operator
  template:
    metadata:
      labels:
        name: cluster-storage-operator
    spec:
      nodeSelector:
        node-role.kubernetes.io/master: ""
      tolerations:
      - key: node-role.kubernetes.io/master  # Just tolerate NoSchedule taint on master node. If there are other conditions like disk-pressure etc, let's not schedule the control-plane pods onto that node.
        operator: Exists
        effect: "NoSchedule"
      - key: "node.kubernetes.io/unreachable"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 120 # Evict pods within 2 mins.
      - key: "node.kubernetes.io/not-ready"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 120 # Evict pods within 2 mins.
      priorityClassName: system-cluster-critical
      serviceAccountName: cluster-storage-operator
      securityContext:
        fsGroup: 10400
        runAsGroup: 10400
        runAsUser: 10400
      containers:
        - name: cluster-storage-operator
          image: quay.io/ydayagi/cso:latest
          terminationMessagePolicy: FallbackToLogsOnError
          ports:
          - containerPort: 8443
            name: metrics
          command:
          - cluster-storage-operator
          - start
          imagePullPolicy: IfNotPresent
          env:
          - name: OPERATOR_IMAGE_VERSION
            value: "0.0.1-snapshot"
          - name: OPERAND_IMAGE_VERSION
            value: "0.0.1-snapshot"
          - name: AWS_EBS_DRIVER_OPERATOR_IMAGE
            value: quay.io/openshift/origin-aws-ebs-csi-driver-operator:latest
          - name: AWS_EBS_DRIVER_IMAGE
            value: quay.io/openshift/origin-aws-ebs-csi-driver:latest
          - name: GCP_PD_DRIVER_OPERATOR_IMAGE
            value: quay.io/openshift/origin-gcp-pd-csi-driver-operator:latest
          - name: GCP_PD_DRIVER_IMAGE
            value: quay.io/openshift/origin-gcp-pd-csi-driver:latest
          - name: OPENSTACK_CINDER_DRIVER_OPERATOR_IMAGE
            value: quay.io/openshift/origin-openstack-cinder-csi-driver-operator:latest
          - name: OPENSTACK_CINDER_DRIVER_IMAGE
            value: quay.io/openshift/origin-openstack-cinder-csi-driver:latest
          - name: OVIRT_DRIVER_OPERATOR_IMAGE
            value: quay.io/openshift/origin-ovirt-csi-driver-operator:latest
          - name: OVIRT_DRIVER_IMAGE
            value: quay.io/openshift/origin-ovirt-csi-driver:latest
          - name: MANILA_DRIVER_OPERATOR_IMAGE
            value: quay.io/openshift/origin-csi-driver-manila-operator:latest
          - name: MANILA_DRIVER_IMAGE
            value: quay.io/openshift/origin-csi-driver-manila:latest
          - name: MANILA_NFS_DRIVER_IMAGE
            value: quay.io/openshift/origin-csi-driver-nfs:latest
          - name: KUBEVIRT_DRIVER_OPERATOR_IMAGE
            value: quay.io/ydayagi/kubevirt-csi-driver-operator:latest
          - name: KUBEVIRT_DRIVER_IMAGE
            value: quay.io/ydayagi/csi-driver:latest
          - name: PROVISIONER_IMAGE
            value: quay.io/openshift/origin-csi-external-provisioner:latest
          - name: ATTACHER_IMAGE
            value: quay.io/openshift/origin-csi-external-attacher:latest
          - name: RESIZER_IMAGE
            value: quay.io/openshift/origin-csi-external-resizer:latest
          - name: SNAPSHOTTER_IMAGE
            value: quay.io/openshift/origin-csi-external-snapshotter:latest
          - name: NODE_DRIVER_REGISTRAR_IMAGE
            value: quay.io/openshift/origin-csi-node-driver-registrar:latest
          - name: LIVENESS_PROBE_IMAGE
            value: quay.io/openshift/origin-csi-livenessprobe:latest
          - name: VSPHERE_PROBLEM_DETECTOR_OPERATOR_IMAGE
            value: quay.io/openshift/origin-vsphere-problem-detector:latest
          resources:
            requests:
              cpu: 10m
              memory: 20Mi
          volumeMounts:
            - mountPath: /var/run/secrets/serving-cert
              name: cluster-storage-operator-serving-cert
      volumes:
        - name: cluster-storage-operator-serving-cert
          secret:
            secretName: cluster-storage-operator-serving-cert
            optional: true
