---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cluster-autoscaler-operator
  namespace: openshift-machine-api
  labels:
    k8s-app: cluster-autoscaler-operator
  annotations:
    exclude.release.openshift.io/internal-openshift-hosted: "true"
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: kube-rbac-proxy
        args:
        - --secure-listen-address=0.0.0.0:9192
        - --upstream=http://127.0.0.1:9191/
        - --tls-cert-file=/etc/tls/private/tls.crt
        - --tls-private-key-file=/etc/tls/private/tls.key
        - --config-file=/etc/kube-rbac-proxy/config-file.yaml
        - --logtostderr=true
        - --v=10
        image: quay.io/openshift/origin-kube-rbac-proxy:4.2.0
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9192
          name: metrics
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - name: auth-proxy-config
          mountPath: /etc/kube-rbac-proxy
          readOnly: true
        - name: cert
          mountPath: /etc/tls/private
          readOnly: true
      - 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: "9191"
        ports:
        - containerPort: 8443
        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
      - name: auth-proxy-config
        configMap:
          name: kube-rbac-proxy-cluster-autoscaler-operator
      nodeSelector:
        node-role.kubernetes.io/master: ""
      restartPolicy: Always
      securityContext:
        runAsNonRoot: true
        runAsUser: 65534
      tolerations:
      - key: "node-role.kubernetes.io/master"
        operator: "Exists"
        effect: "NoSchedule"
