Repository navigation
test(e2e): prove the deployable identity broker slice in kind - #2987
Conversation
The hosted AS-1 spec now installs the identity broker with chart-delivered settings, an embedded gateway entry, and the gateway's signing key. It checks that AS-1's and AS-2's published keys survive a restart, rotates the broker client key through an overlapping key set with helm upgrade, and checks that mecak8s refuses shared keys and a key set without the broker client key. Co-authored-by: Mecatl <[email protected]>
rdimitrov
left a comment
There was a problem hiding this comment.
Ran the focused Kind block locally (-ginkgo.focus='hosted AS-1'): 11 of 11 specs pass. The identity broker unit tests, the chart's Go tests, and helm unittest also pass. Nothing blocking; three points.
1. The rotation spec passes for any order that ends in a valid configuration. AS-1, AS-2, and the broker restart together, so each step reads the key and the key set fresh. Skipping step 1 (new private key straight to a key set holding only the new key) would also pass. The operator guide already says the overlap prevents no refused request in this layout. What actually protects the rotation is that mecak8s refuses the wrong order at startup. Suggest adding that negative step to the spec: the new private key with the old-only jwks.json, expecting "does not hold the broker client key's public key". Then reword the PR table row to "each step of the guide starts and serves sign-in; the wrong order is refused at startup".
2. AS-1 signing key rotation with a fallback isn't exercised in Kind. In this layout it's the one rotation where the overlap is observable: an AS-1 access token issued before a restart still verifies after it, as the restart spec shows. Nothing runs the chart's fallback projection (as1-signing-fallback-0/) in a real pod. #2815's testable result doesn't require it, but #2814's "Done when" lists it. Suggested shape: rotate as1Signing to a new key with the old one as a fallback, check the earlier token still opens a session and the JWKS publishes both keys, then remove the fallback and check that the token is refused. Fine as a follow-up if it doesn't belong here.
3. Risk for operators syncing keys from a secret manager. The guide offers two ways to rotate: change the Secret key name, which rolls the pod, or update the Secret in place and run kubectl rollout restart. The test covers only the first. External Secrets Operator and Secrets Store CSI users will usually take the second, since they can't easily rename keys. If the broker client key and its key set are in two Secrets that sync separately, a restart between the two syncs (a node drain, for example) crash-loops the pod on the key-set check. A line in the guide to keep both in one Secret, synced atomically, would cover it. That's a docs follow-up, not a change to this PR.
… a fallback The broker client rotation now also shows that signing with a key the key set does not hold is refused at startup. A new spec rotates AS-1's signing key through the chart's fallback: tokens signed by the old key open sessions while it is a fallback and are refused once it is removed. The guide says to sync the broker client key and its key set together. Co-authored-by: Mecatl <[email protected]>
|
Thanks, all three are addressed in 58f64f3.
Focused Kind run: all 11 specs pass. The two rotation specs take 37 s and 34 s. |
Closes #2815 (Phase 1, Slice 7: the slice test). #2538, #2813 and #2814 are merged.
Summary
The Kind suite's hosted AS-1 spec now proves the slice's testable result against a release the chart delivers.
installAS1Releasealways installs fiveidentityBroker.settings, an embedded gateway entry withservers: [],mcp.broker.signingKey, the callback URL, and an OAuth MCP server, so every existing sign-in, session, and isolation spec runs on that release. A new It checks the rendered configuration and that AS-2 publishes the operator's gateway signing key.idJAGMaxLifetimeto90smakes mecak8s refuse the chart'sclockSkewof10s(more than a tenth), so mecak8s loads the delivered settings rather than defaults.helm upgradesteps starts and serves a fresh sign-in and session open, and the last step only passes if the broker signs with the new key. The wrong order (the new private key with a key set that holds only the old public key) is refused at startup, which is what protects a rotation while everything runs in one replica.helm templateerror. For shared keys (the same key in two Secrets, which the chart can't see) and for a key set without the broker client key, the pod never becomes Ready and its log has the startup refusal. A good release is then restored and used.as1Signing.fallbacks. While the old key is a fallback, the JWKS publishes both keys and a token signed before the rotation still opens a session. Once the fallback is removed, the JWKS publishes only the new key and that token is refused.Not proven
API compatibility
None. This change is tests only.
Testing
-ginkgo.focus='hosted AS-1'): all 11 specs pass. The two rotation specs take 37 s and 34 s; the block adds about two minutes of CI time.task e2e:k8s: 26 passed, 1 failed (remote learning worker failover, a Kubernetes lease API timeout that also fails on its own without this change locally), 3 skipped (live).go vet -tags kind_e2e ./e2e/...: clean.golangci-lint --build-tags kind_e2e: only the four existing revive findings in other files.