fix(bootstrap): keep the install alive on a host with only felis-api

restart_existing_control_plane ended in an and-list per deployment:

    [ "$had_api" = "1" ] && kube ... rollout restart deployment/felis-api
    [ "$had_operator" = "1" ] && kube ... rollout restart deployment/felis-operator

As the LAST command of a function, an and-list whose test is false returns 1,
and that becomes the function's exit status. The call site is bare, so under
`set -Eeuo pipefail` the installer dies there — after the bundle has been
applied and before the rollout wait, leaving a half-finished upgrade and no
message naming the cause.

It fires on any host carrying one control-plane deployment but not the other:
felis-api present without felis-operator restarts the api, then exits 1 on the
second test. Both present, or neither, happened to work, which is why it
survived.

Rewritten as explicit `if` statements, which return 0 when the test is false.
Verified out of tree against all four had_api/had_operator combinations.
This commit is contained in:
flyemoji committed 2026-07-20 18:30:19 +09:00
1 parent fe4c92c1c5
commit d146f1ccd7
1 file changed
+6 -2
+6 -2
View File
@@ -1425,8 +1425,12 @@ restart_existing_control_plane() {
[ "$had_api$had_operator" != "00" ] || return 0 [ "$had_api$had_operator" != "00" ] || return 0
log "restarting existing control-plane deployments to pick up ${FELIS_IMAGE}" log "restarting existing control-plane deployments to pick up ${FELIS_IMAGE}"
[ "$had_api" = "1" ] && kube -n "$CONTROL_NS" rollout restart deployment/felis-api # `if`, not `[ test ] && cmd`: as the LAST command of the function the and-list returns 1
[ "$had_operator" = "1" ] && kube -n "$CONTROL_NS" rollout restart deployment/felis-operator # when the test is false, which becomes the function's exit status and kills the whole
# install under `set -Eeuo pipefail` — right after the bundle is applied and before the
# rollout wait. Fires on any host carrying felis-api without felis-operator.
if [ "$had_api" = "1" ]; then kube -n "$CONTROL_NS" rollout restart deployment/felis-api; fi
if [ "$had_operator" = "1" ]; then kube -n "$CONTROL_NS" rollout restart deployment/felis-operator; fi
} }
# The login/lobby images use local mutable tags. Importing a replacement updates # The login/lobby images use local mutable tags. Importing a replacement updates