From 1d0a4619b43e0a9ca444dca96f0011cc67248acc Mon Sep 17 00:00:00 2001 From: Matt McEuen Date: Mon, 3 Feb 2020 13:57:23 -0600 Subject: [PATCH] Add -u to anchor scripts This adds "set -u" (in addition to the existing -x) to the anchor scripts. This should fix an issue seen occasionally in the haproxy chart which is only explainable by the IDENTIFIER variable failing to get set correctly. All variables used in the anchor scripts ought to be defined, and there's no need to rely on blank strings as defaults. "set -e" was considered for this, but may have unintended side-effects: -u should be safe and avoid the issue we've seen. Change-Id: Idbc2f9f77d4754874999d5d83d322a17076c7392 --- charts/apiserver/templates/bin/_anchor.tpl | 2 +- charts/controller_manager/templates/bin/_anchor.tpl | 2 +- charts/etcd/templates/bin/_etcdctl_anchor.tpl | 2 +- charts/haproxy/templates/bin/_anchor.tpl | 2 +- charts/scheduler/templates/bin/_anchor.tpl | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/apiserver/templates/bin/_anchor.tpl b/charts/apiserver/templates/bin/_anchor.tpl index ef5d4f6c..081b8604 100644 --- a/charts/apiserver/templates/bin/_anchor.tpl +++ b/charts/apiserver/templates/bin/_anchor.tpl @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -x +set -xu snapshot_files() { SNAPSHOT_DIR=${1} diff --git a/charts/controller_manager/templates/bin/_anchor.tpl b/charts/controller_manager/templates/bin/_anchor.tpl index e1d1b612..20b76292 100644 --- a/charts/controller_manager/templates/bin/_anchor.tpl +++ b/charts/controller_manager/templates/bin/_anchor.tpl @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -x +set -xu compare_copy_files() { diff --git a/charts/etcd/templates/bin/_etcdctl_anchor.tpl b/charts/etcd/templates/bin/_etcdctl_anchor.tpl index 8b1ea8fe..679370ed 100644 --- a/charts/etcd/templates/bin/_etcdctl_anchor.tpl +++ b/charts/etcd/templates/bin/_etcdctl_anchor.tpl @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -set -x +set -xu TEMP_MANIFEST=/tmp/etcd.yaml sync_file () { diff --git a/charts/haproxy/templates/bin/_anchor.tpl b/charts/haproxy/templates/bin/_anchor.tpl index bdc820d0..b2920232 100644 --- a/charts/haproxy/templates/bin/_anchor.tpl +++ b/charts/haproxy/templates/bin/_anchor.tpl @@ -17,7 +17,7 @@ limitations under the License. {{- $envAll := . }} -set -x +set -xu compare_copy_files() { {{- range .Values.conf.anchor.files_to_copy }} diff --git a/charts/scheduler/templates/bin/_anchor.tpl b/charts/scheduler/templates/bin/_anchor.tpl index 86e12ea5..9d8a2da0 100644 --- a/charts/scheduler/templates/bin/_anchor.tpl +++ b/charts/scheduler/templates/bin/_anchor.tpl @@ -15,7 +15,7 @@ # limitations under the License. */}} -set -x +set -xu compare_copy_files() { {{- range .Values.anchor.files_to_copy }}