dex: run 2 replicas without sticky service#3376
dex: run 2 replicas without sticky service#3376danish9039 wants to merge 12 commits intokubeflow:masterfrom
Conversation
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
|
Welcome to the Kubeflow Manifests Repository Thanks for opening your first PR. Your contribution means a lot to the Kubeflow community. Before making more PRs: Community Resources:
Thanks again for helping to improve Kubeflow. |
There was a problem hiding this comment.
Pull request overview
Updates the Kubeflow Dex base manifests to run Dex with two replicas and attempts to keep the multi-step login flow stable by enabling sticky routing at the Kubernetes Service layer.
Changes:
- Increase Dex
Deploymentreplicas from1to2 - Add
sessionAffinity: ClientIPto the DexService
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| common/dex/base/deployment.yaml | Scales Dex to 2 replicas to improve availability. |
| common/dex/base/service.yaml | Enables Service-level ClientIP session affinity to reduce cross-pod auth-flow breakage. |
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
|
Thank you @danish9039 Let us please be precise as explained in the copilot-instructions.md. This is about authentication and not authorization. Are you sure that the storage backend supports it well https://github.com/danish9039/manifests/blob/d1b9474e935ef96d6786722b6c2d4c077e50674b/common/dex/base/config-map.yaml#L11 ? And please extend the Dex test to verify that multiple parallel sessions to different replicas and garbage collection works. |
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
@juliusvonkohout Thank you for the feedback, sorry for the delay! I also extended the test to validate the For garbage collection, the intent is to make sure |
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
|
@juliusvonkohout can we proceed with this ? |
|
"The test now treats a completed OAuth callback plus oauth2_proxy session cookie as authentication success even if the final landing page is rejected later by RBAC" We must also test the authorization and RBAC later. Please do not remove it. |
|
CC also @abdullahpathan22 for review |
|
Please do not rely on kfp in a Dex / oauth2-proxy test. You also have to sign the dco. Less code is better and means less maintenance effort. |
Add a new authorization test that sits one layer above dex_login_test.py. While dex_login_test.py validates the authentication flow (Dex session cookie issuance and multi-replica distribution), this test validates that the Kubeflow RBAC layer correctly enforces access control after a valid session is established. The test reuses DexSessionManager from dex_login_test.py to obtain a session cookie, then probes the Kubeflow Pipelines v2 API with four scenarios: Probe 1: authenticated user accessing their own namespace → HTTP 200 Probe 2: unauthenticated request (no cookie) → HTTP 302/401/403 Probe 3: authenticated user accessing an unauthorized namespace → HTTP 403 Probe 4: ServiceAccount token from unauthorized namespace → HTTP 401/403 This mirrors the pattern established in kserve_test.sh Test 3 (unauthorized ServiceAccount token rejection) and volumes_web_application_test.sh (namespace-scoped RBAC enforcement). Keeping this separate from dex_login_test.py preserves clean failure signals in CI: a broken AuthorizationPolicy will fail this test without polluting the Dex replica/GC validation signal. Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
5bf0a07 to
4785e8c
Compare
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
@juliusvonkohout Just to clarify, this PR does not remove any existing RBAC / authorization coverage from the Dex workflow; that coverage was not part of this test path before. |
Summary of Changes
This PR updates Dex to run with
replicas: 2and aligns the validation strategy with Dex's Kubernetes-backed state model.Instead of adding sticky routing, the change keeps the Dex
Servicenon-sticky and adds validation that multi-replica authentication works correctly when Dex state is shared via Kubernetes CRDs.Changes:
common/dex/base/deployment.yamlreplicas: 1 -> 2common/dex/base/service.yamlsessionAffinityis not required withstorage.type=kubernetestests/dex_login_test.pyPARALLEL_SESSIONS=8)Dependencies
Related Context
Contributor Checklist
Local Validation
Validated on a fresh kind cluster using the Dex login flow and updated test:
common/kubeflow-namespace/base./tests/istio-cni_install.sh./tests/oauth2-proxy_install.shcommon/istio/kubeflow-istio-resources/base./tests/dex_install.sh./tests/central_dashboard_install.shpython3 tests/dex_login_test.pyObserved result:
Conclusion:
replicas: 2without service stickiness when using Kubernetes-backed Dex storage, and the updated test now validates replica distribution and authcode cleanup behavior.