Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
416b9b2
feat(ocsf): guest-sourced markers and unmapped fields on activity bui…
jhjaggars Nov 18, 2026
cf0e665
feat(isolation-interface): allow zero-uid workload identity for privi…
jhjaggars Nov 18, 2026
0e63d8f
feat(policy): privileged restrictive default without in-guest sections
jhjaggars Nov 18, 2026
f97af22
feat(sandbox-backend): boundary protocol extensions for VM-backed bou…
jhjaggars Nov 18, 2026
388ec4a
feat(sandbox): root-workload boundary mode and transparent network relay
jhjaggars Nov 18, 2026
e623f03
feat(supervisor): privileged-mode supervision and guest-reported events
jhjaggars Nov 18, 2026
f1130b0
feat(driver-kubernetes): KubeVirt runtime mode
jhjaggars Nov 18, 2026
816d6f3
feat(helm): RBAC for KubeVirt virtual machines and fences
jhjaggars Nov 18, 2026
601f70c
test(e2e): KubeVirt acceptance demo and attack-surface probes
jhjaggars Nov 18, 2026
f11b70d
docs(gateways): document the Kubernetes driver's KubeVirt runtime mode
jhjaggars Nov 18, 2026
b8c2823
docs(kubevirt): the relay is functional routing, never a security con…
jhjaggars Nov 18, 2026
81bcf93
refactor!: drop the sandboxed KubeVirt workload mode — one untrusted …
jhjaggars Nov 18, 2026
3af969d
test(e2e): single root-mode demo lane, policy, and docs
jhjaggars Nov 18, 2026
5cf274c
fix(driver-kubernetes): pin KubeVirt lifecycle mutations to the check…
jhjaggars Nov 18, 2026
51c655e
feat(driver-kubernetes): CPU and memory limits for KubeVirt sandboxes
jhjaggars Nov 19, 2026
3281608
feat(driver-kubernetes): least-privilege RBAC for the KubeVirt runtime
jhjaggars Nov 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/openshell-driver-kubernetes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ tokio-stream = { workspace = true }
kube = { workspace = true }
kube-runtime = { workspace = true }
k8s-openapi = { workspace = true }
base64 = { workspace = true }
tower = { workspace = true, features = ["timeout"] }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
142 changes: 139 additions & 3 deletions crates/openshell-driver-kubernetes/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,66 @@ impl KubernetesSandboxRuntimeConfig {
}
}

/// How workspaces map to Kubernetes namespaces.
/// Runtime substrate the Kubernetes driver provisions sandboxes on.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum KubernetesRuntimeMode {
/// Provision sandboxes as `agents.x-k8s.io` Sandbox CRs reconciled into
/// pods by the upstream Agent Sandbox controller (default, production
/// path).
#[default]
Pod,
/// Provision sandboxes as `kubevirt.io/v1` `VirtualMachine` objects
/// reconciled by the `KubeVirt` controller (proof of concept).
#[serde(rename = "kubevirt", alias = "kube-virt")]
KubeVirt,
}

impl std::fmt::Display for KubernetesRuntimeMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Pod => f.write_str("pod"),
Self::KubeVirt => f.write_str("kubevirt"),
}
}
}

/// How the guest workload runs.
///
/// `KubeVirt` runtime mode settings (proof of concept).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default, deny_unknown_fields)]
pub struct KubeVirtConfig {
/// containerDisk image providing the bootable guest filesystem. The image
/// must contain a Linux guest with the static `openshell-sandbox`
/// supervisor and an init that consumes the driver-rendered bootstrap
/// Secret (cloudInitNoCloud transport). Not an arbitrary sandbox OCI
/// image — see `e2e/kubevirt/` for the purpose-built image build.
pub guest_image: String,
/// Kubernetes `imagePullPolicy` for the guest containerDisk.
/// Empty string omits the field, using the Kubernetes default.
pub guest_image_pull_policy: String,
/// vCPU cores allocated to each guest.
pub cpu_cores: u32,
/// Guest memory request, e.g. `"1Gi"`.
pub memory: String,
/// Attach a per-sandbox PVC at `/sandbox` so the workspace survives
/// stop/start (mirrors the pod path's PVC-backed workspace).
pub workspace_pvc: bool,
}

impl Default for KubeVirtConfig {
fn default() -> Self {
Self {
guest_image: String::new(),
guest_image_pull_policy: String::new(),
cpu_cores: 1,
memory: "1Gi".to_string(),
workspace_pvc: true,
}
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum WorkspaceMode {
Expand Down Expand Up @@ -464,6 +523,12 @@ pub struct KubernetesComputeConfig {
/// When empty and `sandbox_uid` is set, defaults to the resolved UID.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sandbox_gid: Option<u32>,
/// Runtime substrate the driver provisions sandboxes on. Defaults to
/// `pod` (Agent Sandbox CRs). `kubevirt` creates `KubeVirt`
/// `VirtualMachine` objects directly (proof of concept).
pub runtime: KubernetesRuntimeMode,
/// `KubeVirt` settings, used only when `runtime = "kubevirt"`.
pub kubevirt: KubeVirtConfig,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
Expand Down Expand Up @@ -550,6 +615,8 @@ impl Default for KubernetesComputeConfig {
provider_spiffe_workload_api_socket_path: String::new(),
sandbox_uid: None,
sandbox_gid: None,
runtime: KubernetesRuntimeMode::default(),
kubevirt: KubeVirtConfig::default(),
}
}
}
Expand All @@ -565,7 +632,8 @@ impl KubernetesComputeConfig {
self.validate_proxy_uid()?;
self.validate_upstream_proxy_config()?;
self.validate_allowed_pod_annotations()?;
self.validate_allowed_pod_labels()
self.validate_allowed_pod_labels()?;
self.validate_kubevirt_config()
}

fn validate_bootstrap_windows(&self) -> Result<(), String> {
Expand Down Expand Up @@ -674,6 +742,73 @@ impl KubernetesComputeConfig {
)
}

/// Validate the `KubeVirt` runtime mode configuration (`PoC` constraints).
///
/// The `KubeVirt` runtime supports the same supervisor topologies as the
/// pod path: the default is a dedicated supervisor Pod per sandbox
/// (`supervisor_topology` unset), and `supervisor_topology = "gateway"`
/// places each generation on the gateway's shared supervisor. Which
/// objects the driver provisions differs per topology, but the topology
/// rules themselves (`gateway` requires `shared_supervisor`; `workspace`
/// is not implemented) are enforced by [`Self::validate_supervisor_topology`]
/// for both runtimes, so they are not repeated here.
///
/// `grpc_endpoint` is required for the dedicated topology — its
/// supervisor Pod must reach the gateway, exactly as the pod path's
/// supervisor Pods do — but not for the shared topology, whose guest
/// never learns the gateway endpoint (the boundary resolves the shared
/// supervisor's Service through the API). Any scheme is accepted: a
/// dedicated supervisor carries client TLS material, so an `https://`
/// endpoint (the TLS demo's shape) is as valid as an `http://` one.
pub fn validate_kubevirt_config(&self) -> Result<(), String> {
if self.runtime != KubernetesRuntimeMode::KubeVirt {
return Ok(());
}
if self.supervisor_topology.is_none() && self.grpc_endpoint.trim().is_empty() {
return Err(
"kubevirt runtime with a dedicated supervisor Pod requires grpc_endpoint: the \
supervisor Pod must be able to reach the gateway"
.to_string(),
);
}
if self.kubevirt.guest_image.trim().is_empty() {
return Err(
"kubevirt runtime requires kubevirt.guest_image to be set to a bootable \
containerDisk image"
.to_string(),
);
}
if self.kubevirt.cpu_cores == 0 {
return Err("kubevirt.cpu_cores must be at least 1".to_string());
}
if self.kubevirt.memory.trim().is_empty() {
return Err("kubevirt.memory must be set (e.g. \"1Gi\")".to_string());
}
if !matches!(
self.workspace_mode,
WorkspaceMode::Shared | WorkspaceMode::Managed
) {
return Err(format!(
"kubevirt runtime supports the shared and managed workspace \
modes; configured mode is {}",
self.workspace_mode
));
}
// Every KubeVirt guest runs its workload as root and its boundary
// is untrusted, so the dedicated supervisor is required: a shared
// supervisor would let a parser bug reached by a hostile root guest
// cross tenants.
if self.supervisor_topology.is_some() {
return Err(
"kubevirt runtime requires the dedicated supervisor topology \
(supervisor_topology unset); the gateway-shared supervisor is not \
supported for KubeVirt VMs"
.to_string(),
);
}
Ok(())
}

pub fn validate_proxy_uid(&self) -> Result<(), String> {
self.sandbox_runtime.validate()
}
Expand Down Expand Up @@ -1168,8 +1303,9 @@ fn validate_provider_spiffe_workload_api_socket_path_value(

#[cfg(test)]
mod tests {

use super::*;
use std::collections::BTreeMap as HashMap;
use BTreeMap as HashMap;

#[test]
fn app_endpoint_configuration_has_one_port_source_and_explicit_enablement() {
Expand Down
Loading
Loading