---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cluster-autoscaler-operator
  namespace: openshift-machine-api
  labels:
    k8s-app: cluster-autoscaler-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: cluster-autoscaler-operator
  template:
    metadata:
      labels:
        k8s-app: cluster-autoscaler-operator
    spec:
      priorityClassName: system-node-critical
      serviceAccountName: cluster-autoscaler-operator
      containers:
      - name: cluster-autoscaler-operator
        image: docker.io/openshift/origin-cluster-autoscaler-operator:v4.0
        command:
        - cluster-autoscaler-operator
        args:
        - -alsologtostderr
        env:
        - name: RELEASE_VERSION
          value: "0.0.1-snapshot"
        - name: WATCH_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: CLUSTER_AUTOSCALER_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: LEADER_ELECTION_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: CLUSTER_AUTOSCALER_IMAGE
          value: docker.io/openshift/origin-cluster-autoscaler:v4.0
        - name: WEBHOOKS_CERT_DIR
          value: /etc/cluster-autoscaler-operator/tls
        - name: WEBHOOKS_PORT
          value: "8443"
        - name: METRICS_PORT
          value: "8080"
        ports:
        - containerPort: 8443
        - name: metrics
          containerPort: 8080
        resources:
          requests:
            cpu: 20m
            memory: 50Mi
        volumeMounts:
        - name: ca-cert
          mountPath: /etc/cluster-autoscaler-operator/tls/service-ca
          readOnly: true
        - name: cert
          mountPath: /etc/cluster-autoscaler-operator/tls
          readOnly: true
        terminationMessagePolicy: FallbackToLogsOnError
      volumes:
      - name: ca-cert
        configMap:
          name: cluster-autoscaler-operator-ca
          items:
          - key: service-ca.crt
            path: ca-cert.pem
      - name: cert
        secret:
          secretName: cluster-autoscaler-operator-cert
          items:
          - key: tls.crt
            path: tls.crt
          - key: tls.key
            path: tls.key
      nodeSelector:
        node-role.kubernetes.io/master: ""
      restartPolicy: Always
      securityContext:
        runAsNonRoot: true
        runAsUser: 65534
      tolerations:
      - key: "node-role.kubernetes.io/master"
        operator: "Exists"
        effect: "NoSchedule"
