Cold-start denials: gate readiness on the Snapshot + retry the exchange on a dropped request #51
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lab/authz-bridge#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Two classes of failures observed live on the portable cluster:
Cold-start / readiness: a fresh replica receives traffic before it can
serve it. The default
readyzwashealthz.Ping(always ready), so duringthe window before the per-replica Snapshot is populated (the mirror reading
the managed Registry Secret), requests fail with "unknown host" (403) or
"Cookie key is not ready" (503). The same shows up as "a new leader can't
serve requests" — the pod is ready (gets traffic) before its Snapshot is
built.
Cold token exchange: the first RFC 8693 exchange on a replica is slow
(TLS/connection setup to the IdP token endpoint). The gateway's ext_authz
timeout fires first, canceling the gRPC context; the bridge logs
The token exchange failed ... context canceledand the client gets a 403.The aborted exchange does not reliably warm the per-replica token cache, so
the next request can be cold again.
Plan
readyzon the Snapshot: the manager's readiness check returnsnot-ready until the per-replica Snapshot holds at least one App and the
Cookie codec (
Snapshot.Ready()). A replica then never receives trafficbefore it can serve. The mirror is not leader-gated (it reads the managed
Registry Secret directly), so a fresh replica becomes ready from the existing
Registry without waiting to be elected leader (no leader/readiness
deadlock).
because the gRPC request context was canceled (the gateway dropped it), retry
once with a fresh, non-cancelable context (
context.WithoutCancel, valuespreserved so the
requestIDstays on the logs). The result is cached, so thenext request is served fast instead of re-hitting the cold path.
V(1)lines by default: add--zap-log-level=2to themanager manifest so per-request Check/callback/exchange decisions are visible
without a temporary patch.
(Adapted from the original
ginjiruu/authz-bridgeedge-case handling — its"gate readyz on the config store" and "retry with a fresh context when the
request context is canceled" patterns — without adopting its overall design.)