From 3b7037366123d7b022733f5aeed8c5210407b82f Mon Sep 17 00:00:00 2001
From: Jonathan Raymond <jonwraymond@gmail.com>
Date: Wed, 18 Oct 2023 17:05:47 -0600
Subject: [PATCH 1/2] fix(cluster-autoscaler-chart): if
 secretKeyRefNameOverride is true, don't create secret

Signed-off-by: Jonathan Raymond <jonwraymond@gmail.com>
---
 charts/cluster-autoscaler/Chart.yaml            |  2 +-
 charts/cluster-autoscaler/templates/secret.yaml | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/charts/cluster-autoscaler/Chart.yaml b/charts/cluster-autoscaler/Chart.yaml
index 394a0be6d268..588058162586 100644
--- a/charts/cluster-autoscaler/Chart.yaml
+++ b/charts/cluster-autoscaler/Chart.yaml
@@ -1,5 +1,5 @@
 apiVersion: v2
-appVersion: 1.27.2
+appVersion: 1.27.3
 description: Scales Kubernetes worker nodes within autoscaling groups.
 engine: gotpl
 home: https://github.com/kubernetes/autoscaler
diff --git a/charts/cluster-autoscaler/templates/secret.yaml b/charts/cluster-autoscaler/templates/secret.yaml
index 9c58d0feb1a6..5096a2249b27 100644
--- a/charts/cluster-autoscaler/templates/secret.yaml
+++ b/charts/cluster-autoscaler/templates/secret.yaml
@@ -1,11 +1,16 @@
-{{- if or (eq .Values.cloudProvider "azure") (and (eq .Values.cloudProvider "aws") (not (has "" (list .Values.awsAccessKeyID .Values.awsSecretAccessKey)))) }}
+{{- if not .Values.secretKeyRefNameOverride }}
+{{- $isAzure := eq .Values.cloudProvider "azure" }}
+{{- $isAws := eq .Values.cloudProvider "aws" }}
+{{- $awsCredentialsProvided := and .Values.awsAccessKeyID .Values.awsSecretAccessKey }}
+
+{{- if or $isAzure (and $isAws $awsCredentialsProvided) }}
 apiVersion: v1
 kind: Secret
 metadata:
   name: {{ template "cluster-autoscaler.fullname" . }}
   namespace: {{ .Release.Namespace }}
 data:
-{{- if eq .Values.cloudProvider "azure" }}
+{{- if $isAzure }}
   ClientID: "{{ .Values.azureClientID | b64enc }}"
   ClientSecret: "{{ .Values.azureClientSecret | b64enc }}"
   ResourceGroup: "{{ .Values.azureResourceGroup | b64enc }}"
@@ -14,8 +19,9 @@ data:
   VMType: "{{ .Values.azureVMType | b64enc }}"
   ClusterName: "{{ .Values.azureClusterName | b64enc }}"
   NodeResourceGroup: "{{ .Values.azureNodeResourceGroup | b64enc }}"
-{{- else if eq .Values.cloudProvider "aws" }}
+{{- else if $isAws }}
   AwsAccessKeyId: "{{ .Values.awsAccessKeyID | b64enc }}"
   AwsSecretAccessKey: "{{ .Values.awsSecretAccessKey | b64enc }}"
 {{- end }}
 {{- end }}
+{{- end }}

From 7e0b682b33b066836ac2651fa8bf42815f4cb101 Mon Sep 17 00:00:00 2001
From: Jonathan Raymond <jonwraymond@gmail.com>
Date: Wed, 18 Oct 2023 17:10:18 -0600
Subject: [PATCH 2/2] fix: correct version bump

Signed-off-by: Jonathan Raymond <jonwraymond@gmail.com>
---
 charts/cluster-autoscaler/Chart.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/charts/cluster-autoscaler/Chart.yaml b/charts/cluster-autoscaler/Chart.yaml
index 588058162586..c5219cf940d0 100644
--- a/charts/cluster-autoscaler/Chart.yaml
+++ b/charts/cluster-autoscaler/Chart.yaml
@@ -1,5 +1,5 @@
 apiVersion: v2
-appVersion: 1.27.3
+appVersion: 1.27.2
 description: Scales Kubernetes worker nodes within autoscaling groups.
 engine: gotpl
 home: https://github.com/kubernetes/autoscaler
@@ -11,4 +11,4 @@ name: cluster-autoscaler
 sources:
   - https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler
 type: application
-version: 9.29.3
+version: 9.29.4