Skip to content

Commit 7c11c99

Browse files
committed
refactor(kubernetes): centralize workspace namespace mapping
Signed-off-by: Gordon Sim <gsim@redhat.com>
1 parent 6872156 commit 7c11c99

4 files changed

Lines changed: 211 additions & 42 deletions

File tree

‎architecture/compute-runtimes.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ reconciler that turns admin-authored TOML profiles into generated
265265
`SandboxTemplate` and `SandboxWarmPool` resources. That reconciler is
266266
independent of the create-path matcher: admins can use it, Helm, kubectl, or
267267
another controller to create warm pools, and the matcher only considers the
268-
resulting enabled warm-pool resources and their fingerprints.
268+
resulting enabled warm-pool resources and their fingerprints. Sandbox creation
269+
and profile reconciliation share one workspace-to-namespace mapping boundary;
270+
the current shared-namespace implementation maps every workspace to the
271+
configured Kubernetes namespace.
269272
The gateway starts the profile reconciler only on the replica holding the
270273
shared reconciler lease and stops it before returning that replica to standby.
271274
The read-side warm-pool cache still runs on every replica so local create

‎crates/openshell-driver-kubernetes/README.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ allocation. When `warm_pooling.enabled` is true, the driver watches and caches
3434
`openshell.ai/enabled=true`, resolves each pool's referenced
3535
`SandboxTemplate`, and computes an in-memory fingerprint of the template spec.
3636

37-
On create, the driver renders the Kubernetes spec that direct `Sandbox`
38-
creation would use, strips per-sandbox identity values from the fingerprint,
39-
and matches it against the warm-pool cache for the target Kubernetes namespace.
37+
On create, the driver maps the OpenShell workspace to its target Kubernetes
38+
namespace, renders the spec that direct `Sandbox` creation would use, strips
39+
per-sandbox identity values from the fingerprint, and matches it against the
40+
warm-pool cache for that namespace. The current shared-namespace mapping sends
41+
every workspace to the configured Kubernetes namespace.
4042
If exactly one pool matches, the driver creates a v1beta1 `SandboxClaim` with
4143
`spec.warmPoolRef.name` set to that pool. If no pool matches, multiple pools
4244
match, RBAC prevents cache maintenance, or the v1beta1 extension APIs are
@@ -51,7 +53,8 @@ ConfigMaps when `warm_pooling.profiles.enabled` is true. Profiles live in the
5153
configured profile namespace, use the `warm-pool.toml` data key, and expose a
5254
narrow CLI-shaped schema: `workspace`, `replicas`, `image`,
5355
`runtime_class_name`, `[environment]`, and `[resources]` with `cpu`, `memory`,
54-
and `gpu_count`. The reconciler generates ordinary `SandboxTemplate` and
56+
and `gpu_count`. The reconciler uses the same workspace-to-namespace mapping as
57+
sandbox creation and generates ordinary `SandboxTemplate` and
5558
`SandboxWarmPool` resources labelled `openshell.ai/enabled=true`; the existing
5659
matching cache then handles allocation unchanged.
5760

0 commit comments

Comments
 (0)