fix: gate readiness on the Snapshot + retry the exchange on a dropped request #52
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lab/authz-bridge!52
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/readiness-gate-and-cold-start"
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?
Closes #51
What
readyzon the Snapshot (cmd/main.go,internal/snapshot/snapshot.go): the manager's readiness check now returns not-ready until the per-replica Snapshot holds at least one App and the Cookie codec (Snapshot.Ready()). A replica never receives traffic before it can serve — no cold-start "unknown host" (403) / "Cookie key is not ready" (503) denials. 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.internal/serve/exchange.go): when the token exchange fails because the gRPC request context was canceled (the gateway's ext_authz timeout on a slow cold exchange), retry once with a fresh, non-cancelable context (context.WithoutCancel, values preserved so therequestIDstays on the logs). The result is cached, so the next request is fast instead of re-hitting the cold path.V(1)lines by default (config/manager/manager.yaml):--zap-log-level=2in the manifest, so per-request decisions are visible without a temporary patch.Tests
TestSnapshotReady:Ready()requires both an App set and the Cookie codec (all four combinations).TestExchangeRetriesWithFreshContextWhenCanceled: a canceled request context still yields an OK response (the fresh-context retry serves it and reaches the token endpoint).Live verification (portable cluster)
{"msg":"Bearer token failed validation","requestID":"defaultlevel-…",…}.context canceled), the bridge loggedRetrying the token exchange with a fresh contextand warmed the cache; attempt 3 was a fastServed the Exchange Check from the token cache(200).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.