Skip to content

feat(server): allow SSO ServiceAccount to override UI default namespace#16097

Open
trollkarlen wants to merge 1 commit into
argoproj:mainfrom
trollkarlen:default-ns-pr
Open

feat(server): allow SSO ServiceAccount to override UI default namespace#16097
trollkarlen wants to merge 1 commit into
argoproj:mainfrom
trollkarlen:default-ns-pr

Conversation

@trollkarlen
Copy link
Copy Markdown

Adds a 'workflows.argoproj.io/default-namespace' annotation, read from the matched SSO-mapping ServiceAccount in gatekeeper. When set, its value replaces ServiceAccountNamespace in the claims returned via /api/v1/userinfo, so the UI lands the user in their tenant namespace instead of the install namespace. Opt-in; absent annotation preserves prior behavior.

Fixes

So the default namespace can be a user scoped NS and not install NS

Motivation

For multi tenancy with one server and oauth and dynamic provisioning

Modifications

Verification

Added tests

Documentation

Added docs

AI

yes, opencode

…espace

Adds a `workflows.argoproj.io/default-namespace` annotation, read from the
matched SSO-mapping ServiceAccount in gatekeeper. When set, its value
replaces ServiceAccountNamespace in the claims returned via
/api/v1/userinfo, so the UI lands the user in their tenant namespace
instead of the install namespace. Opt-in; absent annotation preserves
prior behavior.

Also fixes two UI gaps that prevented the annotation from taking
effect on a freshly logged-in SSO user:

1. `getCurrentNamespace()` used `??` to fall back from
   `current_namespace`, which preserves empty string. A user who
   ever loaded the all-namespaces view persisted
   `current_namespace = ""` to localStorage, shadowing both the
   new SA-annotation default and the legacy SA-namespace default.
   Switch to `||` so empty string falls through.

2. `WorkflowsList` initialized its local namespace state from
   `getNamespace(match.params.namespace) || ""`, which only honors
   managedNamespace and ignores the userNamespace seeded by
   app-router from `/userinfo`. After the OAuth redirect to bare
   `/workflows`, this left the page on namespace="" and a 403.
   Add `getCurrentNamespace()` to the fallback chain.

Signed-off-by: Robert Marklund <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant