apiVersion: apps/v1
kind: Deployment
metadata:
  name: cluster-version-operator
  namespace: openshift-cluster-version
  annotations:
    exclude.release.openshift.io/internal-openshift-hosted: "true"
spec:
  selector:
    matchLabels:
      k8s-app: cluster-version-operator
  strategy:
    type: Recreate
  template:
    metadata:
      name: cluster-version-operator
      labels:
        k8s-app: cluster-version-operator
    spec:
      containers:
      - name: cluster-version-operator
        image: {{.ReleaseImage}}
        imagePullPolicy: IfNotPresent
        args:
          - "start"
          - "--release-image={{.ReleaseImage}}"
          - "--enable-auto-update=false"
          - "--enable-default-cluster-version=true"
          - "--v=4"
        resources:
          requests:
            cpu: 20m
            memory: 50Mi
        terminationMessagePolicy: FallbackToLogsOnError
        volumeMounts:
          - mountPath: /etc/ssl/certs
            name: etc-ssl-certs
            readOnly: true
          - mountPath: /etc/cvo/updatepayloads
            name: etc-cvo-updatepayloads
            readOnly: true
        env:
          - name: KUBERNETES_SERVICE_PORT # allows CVO to communicate with apiserver directly on same host.
            value: "6443"
          - name: KUBERNETES_SERVICE_HOST # allows CVO to communicate with apiserver directly on same host.
            value: "127.0.0.1"
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
      hostNetwork: true
      nodeSelector:
        node-role.kubernetes.io/master: ""
      priorityClassName: "system-cluster-critical"
      tolerations:
      - key: "node-role.kubernetes.io/master"
        operator: Exists
        effect: "NoSchedule"
      - key: "node.kubernetes.io/unschedulable"
        operator: Exists
        effect: "NoSchedule"
      - key: "node.kubernetes.io/network-unavailable"
        operator: Exists
        effect: "NoSchedule"
      - key: "node.kubernetes.io/not-ready"
        operator: "Exists"
        effect: "NoSchedule" 
      - key: "node.kubernetes.io/unreachable"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 120 
      - key: "node.kubernetes.io/not-ready"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 120 
      volumes:
        - name: etc-ssl-certs
          hostPath:
            path: /etc/ssl/certs
        - name: etc-cvo-updatepayloads
          hostPath:
            path: /etc/cvo/updatepayloads
