Skip to content

crucible-kueue: disposable vcluster environments - #546

Open
MatthewBonanni wants to merge 3 commits into
neuralmagic:mainfrom
MatthewBonanni:mbonanni/kueue-environments
Open

MatthewBonanni wants to merge 3 commits into
neuralmagic:mainfrom
MatthewBonanni:mbonanni/kueue-environments

Conversation

@MatthewBonanni

@MatthewBonanni MatthewBonanni commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Lets a run get a disposable vcluster from crucible-kueue, install a platform the host does not run into it (for example a pinned upstream KServe release), and run workloads there. Its GPU pods still queue through the host's Kueue, and the guest's credential never leaves the server. Decision: ADR-0083.

New tools

  • environment_create {name, queue, duration_seconds} creates an LLMWorkloadEnvironment (mode VCluster). Its ClusterQueue is the named LocalQueue's. Lifetime is 15 minutes to 12 hours, 4 hours by default.
  • environment_status returns the operator's conditions. ready is true once the guest answers and the backing namespace has the operator's LocalQueue; otherwise problems says why.
  • environment_apply {name, objects} server-side applies any objects into the guest, in order. On failure the error names the index of the object that failed.
  • A batch workload submitted into an environment is not created suspended: no Kueue runs in the guest to release it, and the host admits its pods one by one.
  • environment_delete deletes an environment this run created.

Workload tools in an environment

  • workload_plan, workload_submit, workload_status, workload_logs, workload_scale, workload_stop, workload_resume and workload_delete take an optional environment.
  • The object, its pods, events and logs are in the guest's default namespace.
  • Kueue Workloads (matched to host pods by the vcluster's name translation) and queue position are read in the backing host namespace.

Guest policies. Before any write into a guest, the server applies two MutatingAdmissionPolicies there:

  • One stamps the environment's queue label on every pod.
  • One drops pinned runAsUser/fsGroup so OpenShift's SCC assigns them, and sets HOME=/tmp on containers that have no HOME.

Access and RBAC

  • A call in an environment is checked on the llmworkloadenvironments object: get to read, update to act, create (plus the queue) to create, delete to delete.
  • Deploy RBAC grants those verbs to the server and to callers.
  • The server also gets cluster-wide get/list on LocalQueues, Workloads and pending workloads, because backing namespaces are created dynamically.

Clients. The Python and Rust clients take environment on wait and on the workload calls, and the Python client gains the four environment methods.

Host prerequisites. The LLMWorkloadEnvironment operator must have its Kueue integration on, so backing namespaces get the managed label and a LocalQueue default. A host that must not rely on the guest-side queue stamp should add a ValidatingAdmissionPolicy that refuses pods without a queue label in the operator's namespaces.

Validation

  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test -p crucible-kueue -p crucible-kueue-client: 206 unit tests and the client tests pass.
  • cargo test -p crucible deploy::: 190 tests pass.
  • pytest crucible-kueue-py/tests: 13 tests pass, against the real router.
  • govctl check: no new warnings.
  • Prototype on an OpenShift cluster with B200s, done by hand ahead of this PR. A vcluster's pods were admitted by the host's Kueue. Upstream KServe v0.21.0 LLMInferenceService (Envoy Gateway, GIE, llm-d) ran in the guest, and a chat completion through its gateway succeeded.
  • End-to-end through these tools on the same cluster: a_job_in_an_environment_runs_in_its_guest_and_queues_on_the_host (new) passes in 81 s.
    • Run in tenant mode through an in-cluster CONNECT proxy, with --features kube/http-proxy.
    • The cluster's operator has its Kueue integration off, so a helper script labelled the backing namespace and created LocalQueue default in its place.
    • Covered: create then ready; apply, with a crucible-kueue-* object refused; plan, submit, status, logs and delete of a guest Job, which the host's Kueue admitted and which finished; then environment_delete.
    • This e2e found that batch kinds were created suspended in the guest, where no Kueue runs to release them. A Job submitted into an environment is now not suspended.

🤖 Generated with Claude Code

MatthewBonanni and others added 3 commits December 1, 2026 17:23
Adds ADR-0083 and the environment module: creating an
LLMWorkloadEnvironment, building a guest client from the kubeconfig its
status publishes, the guest admission policies that stamp the queue
label and let the host assign pod UIDs, and server-side apply into the
guest.

Assisted-by: Claude
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
environment_create/status/apply/delete provision an LLMWorkloadEnvironment
(mode VCluster) through the operator and keep its guest kubeconfig on the
server. The workload tools take an optional environment: the object, its
pods, events and logs live in the guest, while its Kueue Workloads and queue
position are read in the backing host namespace, so guest pods keep queueing
against the host's quota.

Before any write into a guest the server applies two MutatingAdmissionPolicies:
one stamps the environment's queue label on every pod, one drops pinned
runAsUser/fsGroup and gives containers a writable HOME so the host's SCC admits
them. Access checks for calls in an environment are made on the
llmworkloadenvironments object; deploy RBAC grants the server and callers the
verbs, and the server cluster-wide read of LocalQueues and Workloads for
backing namespaces. Clients take environment on wait and the workload calls.

Assisted-by: Claude
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
No Kueue runs in the guest to release it; the host's Kueue admits each of its
pods. Adds a cluster e2e for an environment's lifecycle and a guest Job.

Assisted-by: Claude
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
@MatthewBonanni
MatthewBonanni marked this pull request as ready for review December 1, 2026 22:57

This branch has not been deployed

No deployments
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