ADR-026: Non-Admin Workspace Concurrency Limits
Status
Accepted
Date
2026-07-31
Context
In a multi-tenant agent orchestration environment, users or automated AI clients dynamically spawn ephemeral pod workspaces on demand. Without concurrency caps, a single non-admin user or runaway automated workflow could launch an arbitrary number of workspace pods, consuming excessive Kubernetes cluster CPU, memory, and IP allocation.
Decision
- Configurable User Workspace Quota:
- Introduced
maxWorkspacesPerUserinauthSchema(MAX_WORKSPACES_PER_USERenvironment variable, CLI flag--max-workspaces-per-user). Defaults to0(unlimited).
- Introduced
- Quota Enforcement in Spawner:
- During
spawn_workspace, ifMAX_WORKSPACES_PER_USER > 0and the caller is not an administrator, active non-terminal pods (Pending,Running,Upgrading,Terminating) belonging to the caller are counted. - If the caller's unique workspace count meets or exceeds
MAX_WORKSPACES_PER_USER, the spawner rejects the request with a403 Forbiddenerror.
- During
- Scope Alignment:
- Workspace counts align with
k8s.mode: per-namespace innamespacedmode, and across accessible namespaces inclustermode.
- Workspace counts align with
- Administrator Quota Bypass:
- Administrators (identified via admin roles, admin scopes, or
AUTH_ADMIN_USERS) bypass non-admin workspace quotas to ensure operational emergency access.
- Administrators (identified via admin roles, admin scopes, or
Alternatives Considered
1. Kubernetes Native ResourceQuotas
- Pros: Handled directly by the Kubernetes API server.
- Cons: Requires creating Kubernetes
ResourceQuotaresources per namespace and does not operate natively on custom per-user subject (nogoo9/user-sub) labels. - Rejected: Conflicts with our zero-CRD and zero-cluster-operator architecture.
2. Counting Only 'Running' Pods
- Pros: Simpler status check.
- Cons: Users could bypass quotas by rapidly spawning multiple pods before the initial pod transitions from
PendingtoRunning. - Rejected: Counting all non-terminal phases (
Pending,Running,Upgrading,Terminating) prevents quota evasion.
Consequences
- Prevent Cluster Overload: Prevents individual non-admin users from exhausting cluster compute resources.
- Backward Compatibility: Default
MAX_WORKSPACES_PER_USER=0maintains backward compatibility for existing unconstrained environments.
