From 236ade027b58617029635e4914ed9e5fdc36f30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Tu=C5=BCnik?= Date: Wed, 21 Oct 2020 17:24:03 +0200 Subject: [PATCH] Properly quote flags passed to Cluster Autoscaler In the current implementation, the flags are not put between quotes, and so the Cluster Autoscaler manifest doesn't parse as valid JSON. --- cluster/gce/gci/configure-helper.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 02bc98c357c..0087c84113a 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -2148,12 +2148,14 @@ function start-cluster-autoscaler { # Remove salt comments and replace variables with values local -r src_file="${KUBE_HOME}/kube-manifests/kubernetes/gci-trusty/cluster-autoscaler.manifest" - local params=("${AUTOSCALER_MIG_CONFIG}" "${CLOUD_CONFIG_OPT}" "${AUTOSCALER_EXPANDER_CONFIG:---expander=price}") + local params + read -r -a params <<< "${AUTOSCALER_MIG_CONFIG}" + params+=("${CLOUD_CONFIG_OPT}" "${AUTOSCALER_EXPANDER_CONFIG:---expander=price}") params+=("--kubeconfig=/etc/srv/kubernetes/cluster-autoscaler/kubeconfig") # split the params into separate arguments passed to binary local params_split - params_split=$(eval 'for param in "${params[@]}"; do echo -n "$param",; done') + params_split=$(eval 'for param in "${params[@]}"; do echo -n \""$param"\",; done') params_split=${params_split%?} sed -i -e "s@{{params}}@${params_split}@g" "${src_file}"