Registry builder (the leader's core) #8
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!8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/registry-builder"
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 #3
Implements issue #3 — the Registry builder (the leader's core).
What
internal/registry— the leader's state loader:Build(pure): lists all three kinds cluster-wide, structurally validates (hostnames non-overlapping; policyclientRefresolves;clientSecretRefwell-formed), resolves each valid App's IdP, and produces the Registry plus the per-CRD status. A structurally-invalid App is excluded + Degraded; a missing referenced Secret keeps the App withsecretReady=false(runtime degradation, never removal — ADR-0006).Builder(I/O, leader-gated): checks referenced Secrets, resolves the IdP per-issuer with keep-last-good (idp.Resolvent), writes the managed Registry Secret as a whole-object atomic update (idempotent — no write on unchanged state), applies Available/Degraded +observedGeneration(re-fetch before update,meta.SetStatusConditionsoLastTransitionTimemoves only on real transitions), and aRefreshLooprunnable for the JWKS TTL refresh.Builder.Build; one sharedBuilderis wired incmd/main.go(new flags:--registry-namespace,--registry-secret-name,--registry-refresh-interval), leader-gated viamgr.Elected().openid], session/injection/logout) + Exchange section (clientRef, scopes, subject-token source). OIDC/Exchange sections present iff the App has the policy.secretsget/list/watch/create/update/patch (generated viamake manifests).Testing (seams from spec #1)
internal/registry): entry shape, JSON shape, all structural exclusions, runtime degradation, resolve-failure-without-last-good, duplicate-policy, statuses/observedGeneration.httptestIdP): valid Client + policies → resolved App in the Registry + Available; hostname collision → both excluded + Degraded; malformedclientSecretRef→ excluded + Degraded; danglingclientRef→ policy Degraded + no entry; missing Secret → kept withsecretReady=false+ Degraded; idempotent rebuild (no write on unchanged state); non-leader performs no side-effects.GOTOOLCHAIN=go1.26.0 make lint/make test: clean.