{{- if eq .Values.csp "GCP" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: constellation-cluster-autoscaler
  namespace: {{ .Release.Namespace }}
  labels:
    app.kubernetes.io/instance: constellation
    app.kubernetes.io/managed-by: Constellation
    app.kubernetes.io/name: cluster-autoscaler
spec:
  replicas: 0
  selector:
    matchLabels:
      app.kubernetes.io/instance: constellation
      app.kubernetes.io/name: cluster-autoscaler
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: constellation
        app.kubernetes.io/name: cluster-autoscaler
    spec:
      containers:
      - name: cluster-autoscaler
        image: {{ .Values.image | quote }}
        imagePullPolicy: IfNotPresent
        livenessProbe:
          httpGet:
            path: /health-check
            port: 8085
        ports:
          - containerPort: 8085
        resources: {}
        volumeMounts:
          - mountPath: /var/secrets/google
            name: gcekey
            readOnly: true
        env:
          - name: GOOGLE_APPLICATION_CREDENTIALS
            value: /var/secrets/google/key.json
      dnsPolicy: ClusterFirst
      nodeSelector:
        node-role.kubernetes.io/control-plane: ""
      priorityClassName: system-cluster-critical
      serviceAccountName: constellation-cluster-autoscaler
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
          operator: Exists
        - effect: NoSchedule
          key: node-role.kubernetes.io/control-plane
          operator: Exists
        - effect: NoSchedule
          key: node.cloudprovider.kubernetes.io/uninitialized
          operator: Equal
          value: "true"
      volumes:
        - name: gcekey
          secret:
            secretName: gcekey
{{- end -}}
