---
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
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        resources:
          requests:
            memory: 20Mi
            cpu: 10m
        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: cert
          mountPath: /etc/cluster-autoscaler-operator/tls
          readOnly: true
        terminationMessagePolicy: FallbackToLogsOnError
      volumes:
      - 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
      tolerations:
      - key: "node-role.kubernetes.io/master"
        operator: "Exists"
        effect: "NoSchedule"
