Skip to content

fix: count AB2 sandbox pool CRs by app=sandbox in setup-ocp.sh pre-poll - #105

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:fix/ab2-sandbox-count-selector-103
Jul 14, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:fix/ab2-sandbox-count-selector-103

Conversation

@pdettori

Copy link
Copy Markdown
Member

Summary

Fixes #103. The SH_AUTHBRIDGE=1 sandbox-pool readiness pre-poll in deploy/knative/setup-ocp.sh computed its target container count from a label that the Sandbox CR does not carry, so ab2_want was always 0, the early-break never fired, and the poll spun its full ~5-minute budget before the authoritative kubectl wait.

Root cause

get sandbox -l sh.kagenti.io/sandbox-pool=default   →  0 rows   (label is podTemplate-only)
                                                        ab2_want=0
                                                        [ "$ab2_want" -gt 0 ]  → never true

kubectl get sandbox -l <sel> matches the CR's own metadata.labels (app: sandbox). The sh.kagenti.io/sandbox-pool=default label lives only on podTemplate.metadata.labels for pod discovery — which is why the sibling ab2_ready pod query is correct and unchanged.

Fix

Introduce AB_SANDBOX_SELECTOR="app=sandbox" for the CR count; pod-based operations keep AB_POOL_SELECTOR. One-line semantic change; correctness was never affected (the authoritative kubectl wait still gated) — this only removes the wasted ~5m.

Verification

Live OCP 4.20 (default ns, 3 pool CRs):

selector CRs ab2_want
sh.kagenti.io/sandbox-pool=default (before) 0 0 → never breaks early
app=sandbox (after) 3 6 → breaks once pods Ready

CR's own labels = {"app":"sandbox"}; the pod carries the pool label. bash -n + shellcheck -S error clean.

Regression test (packages/knative-server/test/authbridge-manifests.test.ts): a pure file-parsing, cross-file invariant that extracts the script's get sandbox -l count selector (resolving the shell var) and asserts it matches a label present on the Sandbox CRs in sandbox-pool-ab2.yaml. Fails on the old selector, passes on the fix. Runs in the existing pnpm -r test CI — no cluster.

Assisted-By: Claude Code

The SH_AUTHBRIDGE=1 pool readiness pre-poll derived its target container
count (ab2_want) from `kubectl get sandbox -l sh.kagenti.io/sandbox-pool=default`.
That label lives only on the pod template (podTemplate.metadata.labels) for pod
discovery; the Sandbox CR's own metadata.labels is just `app=sandbox`. A
`get sandbox -l` selector matches the CR's own labels, so the query returned 0
rows, ab2_want stayed 0, the loop's `[ "$ab2_want" -gt 0 ]` early-break never
fired, and the poll burned its full ~150x2s ~= 5 minute budget before the
authoritative `kubectl wait` gated.

Count the CRs by app=sandbox (a label they actually carry) via a new
AB_SANDBOX_SELECTOR; pod-based operations keep AB_POOL_SELECTOR. Live OCP:
`-l sh.kagenti.io/sandbox-pool=default` -> 0 CRs, `-l app=sandbox` -> 3 CRs.

Adds a cross-file manifest-shape regression test tying the script's
get-sandbox count selector to a label present on the Sandbox CRs in
sandbox-pool-ab2.yaml.

Fixes rossoctl#103

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori merged commit e6a3c22 into rossoctl:main Jul 14, 2026
10 checks passed
@pdettori
pdettori deleted the fix/ab2-sandbox-count-selector-103 branch July 14, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setup-ocp.sh: AB2 sandbox-pool readiness poll spins full timeout (queries a podTemplate label on the Sandbox CR)

1 participant