mirror of https://github.com/k3s-io/k3s
Override errexit in kube-up for validate-cluster
parent
2a58c0062d
commit
d959ccd87c
|
@ -53,19 +53,20 @@ echo "... calling kube-up" >&2
|
|||
kube-up
|
||||
|
||||
echo "... calling validate-cluster" >&2
|
||||
if [[ "${EXIT_ON_WEAK_ERROR}" == "true" ]]; then
|
||||
validate-cluster
|
||||
else
|
||||
validate-cluster
|
||||
validate_result="$?"
|
||||
if [[ ${validate_result} != "0" ]]; then
|
||||
if [[ "${validate_result}" == "1" ]]; then
|
||||
exit 1
|
||||
elif [[ "${validate_result}" == "2" ]]; then
|
||||
echo "...ignoring non-fatal errors in validate-cluster" >&2
|
||||
else
|
||||
echo "Got unknown validate result: ${validate_result}"
|
||||
fi
|
||||
# Override errexit
|
||||
(validate-cluster) && validate_result="$?" || validate_result="$?"
|
||||
|
||||
# We have two different failure modes from validate cluster:
|
||||
# - 1: fatal error - cluster won't be working correctly
|
||||
# - 2: weak error - something went wrong, but cluster probably will be working correctly
|
||||
# We always exit in case 1), but if EXIT_ON_WEAK_ERROR != true, then we don't fail on 2).
|
||||
if [[ "${validate_result}" == "1" ]]; then
|
||||
exit 1
|
||||
elif [[ "${validate_result}" == "2" ]]; then
|
||||
if [[ "${EXIT_ON_WEAK_ERROR}" == "true" ]]; then
|
||||
exit 1;
|
||||
else
|
||||
echo "...ignoring non-fatal errors in validate-cluster" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue