From ec41efcb4b1625d43f494e4b68734a0e3f0cd403 Mon Sep 17 00:00:00 2001 From: Chris Wedgwood Date: Tue, 31 Dec 2019 16:11:28 -0800 Subject: [PATCH] [proxy] robustness tweak for liveness probe "wc -l foo" output has two columns causing subtle breakage that shows up as sporadic cryptic errors at times Change-Id: I1f708ed011a48a2fbca6af8f4d021005d2296bfd --- charts/proxy/templates/bin/_liveness-probe.sh.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/proxy/templates/bin/_liveness-probe.sh.tpl b/charts/proxy/templates/bin/_liveness-probe.sh.tpl index e76f4c93..54195cd6 100644 --- a/charts/proxy/templates/bin/_liveness-probe.sh.tpl +++ b/charts/proxy/templates/bin/_liveness-probe.sh.tpl @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -eu IPTS_DIR=/tmp/liveness @@ -20,7 +20,7 @@ fi mkdir -p "${IPTS_DIR}" iptables-save {{- if .Values.livenessProbe.whitelist }} | grep -Ev "${WHITELIST}" {{- end }} | grep -s 'has no endpoints' | sort > "${IPTS_DIR}/current" -if [[ $(wc -l "${IPTS_DIR}/current") -gt 0 ]]; then +if [[ $(wc -l < "${IPTS_DIR}/current") -gt 0 ]]; then if [[ "${IPTS_DIR}/previous" ]]; then if cmp "${IPTS_DIR}/current" "${IPTS_DIR}/previous"; then echo Some non-whitelisted services have no endpoints: