[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
This commit is contained in:
Chris Wedgwood 2019-12-31 16:11:28 -08:00
parent 146a9a5b8e
commit ec41efcb4b
1 changed files with 2 additions and 2 deletions

View File

@ -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: