Allow guarded refresh-free scheduling preflight
This commit is contained in:
parent
0ab53e6bc7
commit
adc141f609
|
|
@ -838,7 +838,7 @@ delete_prometheus_stack_storage() {
|
|||
kubernetes_scheduling_preflight() {
|
||||
local stack="$1"
|
||||
shift
|
||||
local directory status arg
|
||||
local directory status arg plan_output retry_pattern
|
||||
local -a plan_args=()
|
||||
[[ "${stack}" == "bootstrap/platform" || "${stack}" == "bootstrap/apps" ]] || return 0
|
||||
if [[ -z "${LAB_CLUSTER_CONTROL_PLANE_NODE_NAME:-}" ]]; then
|
||||
|
|
@ -850,11 +850,22 @@ kubernetes_scheduling_preflight() {
|
|||
done
|
||||
directory="$(mktemp -d "${TMPDIR:-/tmp}/jeannie-scheduling.XXXXXX")" || return 1
|
||||
echo "Checking scheduling feasibility for ${stack} before deployment..."
|
||||
retry_pattern='bad record MAC|received record with version|first record does not look like a TLS handshake|TLS handshake timeout|unexpected EOF|unexpected error when reading response body|connection reset by peer|context deadline exceeded|failed to query with labels|connection refused|server is currently unable'
|
||||
if ! tofu -chdir="${REPO_ROOT}/${stack}" plan -input=false -out="${directory}/plan" \
|
||||
"${plan_args[@]}" >"${directory}/plan.log" 2>&1; then
|
||||
cat "${directory}/plan.log" >&2
|
||||
rm -rf -- "${directory}"
|
||||
return 1
|
||||
if ! grep -Eiq "${retry_pattern}" "${directory}/plan.log"; then
|
||||
cat "${directory}/plan.log" >&2
|
||||
rm -rf -- "${directory}"
|
||||
return 1
|
||||
fi
|
||||
echo "Scheduling preflight hit a Kubernetes transport error; retrying with guarded -refresh=false plan..." >&2
|
||||
plan_args+=("-refresh=false")
|
||||
if ! tofu -chdir="${REPO_ROOT}/${stack}" plan -input=false -out="${directory}/plan" \
|
||||
"${plan_args[@]}" >"${directory}/plan.log" 2>&1; then
|
||||
cat "${directory}/plan.log" >&2
|
||||
rm -rf -- "${directory}"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
if ! tofu -chdir="${REPO_ROOT}/${stack}" show -json "${directory}/plan" >"${directory}/plan.json"; then
|
||||
rm -rf -- "${directory}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue