---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ca-external-grpc-cloud-provider
  namespace: kube-system
  labels:
    app: ca-external-grpc-cloud-provider
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ca-external-grpc-cloud-provider
  template:
    metadata:
      labels:
        app: ca-external-grpc-cloud-provider
    spec:
      containers:
        - image: ca-external-grpc-cloud-provider-service:dev
          name: ca-external-grpc-cloud-provider
          resources:
            limits:
              cpu: 100m
              memory: 300Mi
            requests:
              cpu: 100m
              memory: 300Mi
          command:
            - ./ca-external-grpc-cloud-provider
            - --v=10
            - --key-cert=/etc/ssl/server-cert/tls.key
            - --cert=/etc/ssl/server-cert/tls.crt
            - --ca-cert=/etc/ssl/server-cert/ca.crt
            - --cloud-provider=aws
            - --node-group-auto-discovery=asg:tag=k8s.io/cluster-autoscaler/enabled,k8s.io/cluster-autoscaler/<YOUR CLUSTER NAME>
          volumeMounts:
            - name: cluster-autoscaler-grpc-server-cert
              mountPath: "/etc/ssl/server-cert"
            - name: ssl-certs
              mountPath: /etc/ssl/certs/ca-certificates.crt
              readOnly: true
          imagePullPolicy: "Always"
      volumes:
        - name: ssl-certs
          hostPath:
            path: /etc/ssl/certs/ca-certificates.crt #/etc/ssl/certs/ca-bundle.crt for Amazon Linux Worker Nodes
        - name: cluster-autoscaler-grpc-server-cert
          secret:
            secretName: cluster-autoscaler-grpc-server-cert
            defaultMode: 0400
