Repository navigation
Fix rancher-lb LoadBalancer wait-loop in RKE2 scripts - #172
Merged
Merged
Conversation
The wait-loop was missing '-o' before the jsonpath template, so
'jsonpath={...}' was parsed as a service name and the query errored
to empty output, causing the loop to never wait. It also queried
.status.conditions[Pending], a shape Services do not have.
Poll the rancher-lb service and block until MetalLB assigns an
external IP instead.
The lint CI runs pre-commit on changed files, so touching these scripts surfaced pre-existing warnings. Address them without changing behavior: - Quote array elements (SC2206) and command substitutions (SC2046). - Disable SC2087 on the ssh heredocs (vars are intentionally expanded client-side) and SC1090 on 'source ~/.bashrc' (not followable). - Keep unused config knobs (KVVERSION, interface) with a targeted SC2034 disable; drop the genuinely-unused allnomaster1 array. - Strip trailing whitespace. Verified: shellcheck --severity=warning clean and pre-commit green (ShellCheck v0.10.0) on both files; bash -n syntax OK.
cyberops7
marked this pull request as ready for review
July 14, 2026 04:24
DefNotJeffrey
approved these changes
Jul 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the "Waiting for LoadBalancer to come online" loop in the RKE2 scripts, which never actually waited.
The loop was written as
kubectl get svc -n cattle-system 'jsonpath={..status.conditions[?(@.type=="Pending")].status}'— but with no-oflag, kubectl treatsjsonpath={...}as a service name. That returns a NotFound error and empty stdout, so[[ "" = "True" ]]is always false and the body never runs. The jsonpath also targeted.status.conditions[Pending], a shape Services do not have (that is a Pod-readiness condition).Now it polls the
rancher-lbservice and blocks until MetalLB assigns an external IP, which is what the message promises:Applied to both
Kubernetes/RKE2/rke2.shandKubernetes/RKE2-Cilium/rke2.sh.Also includes a number of shellcheck fixes.
For context on #21: the exact command it reported (
kubectl get svc name=rancher-lb) is already gone from the scripts, so that specific error no longer occurs. This PR repairs the related rancher-lb LoadBalancer wait that was left broken in the same block.Verification: shellcheck clean on both files; loop semantics tested with a mock kubectl (waits while the IP is empty, exits once an IP appears).
Closes #21