apiVersion: apps/v1
kind: Deployment
metadata:
  name: cluster-autoscaler
  namespace: kube-system
  labels:
    app: cluster-autoscaler
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cluster-autoscaler
  template:
    metadata:
      labels:
        app: cluster-autoscaler
    spec:
      containers:
        - image: cr-hn-1.bizflycloud.vn/1e7f10a9850b45b488a3f0417ccb60e0/cluster-autoscaler:1.0
          name: cluster-autoscaler
          resources:
            limits:
              cpu: 100m
              memory: 300Mi
            requests:
              cpu: 100m
              memory: 300Mi
          command:
            - ./cluster-autoscaler
            - --v=4
            - --stderrthreshold=info
            - --cloud-provider=bizflycloud
            - --skip-nodes-with-local-storage=false
            - --leader-elect=true
            - --expander=least-waste
            - --kubeconfig=/var/lib/kubernetes/clusterxxxx.kubeconfig 
          env:
            - name: BIZFLYCLOUD_AUTH_METHOD
              value: password #application_credential
            - name: BIZFLYCLOUD_EMAIL
              value: xxxxxxxxxxxxxxxxx
            - name: BIZFLYCLOUD_PASSWORD
              value: xxxxxxxxxxxxxxxxx
            # - name: BIZFLYCLOUD_APP_CREDENTIAL_ID
            #   value: xxxxxxxxxxxxxxxxx
            # - name: BIZFLYCLOUD_APP_CREDENTIAL_SECRET
            #   value: xxxxxxxxxxxxxxxxx
            # - name: BIZFLYCLOUD_PROJECT_ID
            #   value: xxxxxxxxxxxxxxxxx
            # - name: BIZFLYCLOUD_TENANT_ID
            #   value: xxxxxxxxxxxxxxxxx
            - name: BIZFLYCLOUD_REGION
              value: HN
            - name: BIZFLYCLOUD_API_URL
              value: https://manage.bizflycloud.vn
            - name: CLUSTER_NAME
              value: xxxxxxxxxxxxxxxxx
          volumeMounts:
            - name: kubeconfig
              mountPath: /var/lib/kubernetes/clusterxxxx.kubeconfig 
              readOnly: true
          imagePullPolicy: "Always"
      volumes:
        - name: ssl-cekubeconfigrts
          hostPath:
            path: "/var/lib/kubernetes/clusterxxxx.kubeconfig"