Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 14 additions & 1 deletion crates/openshell-gateway/src/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ pub struct ConfigureInputs<'a> {
pub admission: Option<&'a openshell_core::resource_admission::DriverAdmissionConfig>,
pub sandbox_runtime_image: Option<String>,
pub supervisor_image: Option<String>,
verified_provider_workload_identity: Option<bool>,
/// How long the driver has to answer `Configure`.
pub configure_timeout: Duration,
}
Expand All @@ -790,6 +791,7 @@ impl<'a> ConfigureInputs<'a> {
sandbox_runtime_image: std::env::var(openshell_core::config::SANDBOX_RUNTIME_IMAGE_ENV)
.ok(),
supervisor_image: std::env::var(openshell_core::config::SUPERVISOR_IMAGE_ENV).ok(),
verified_provider_workload_identity: None,
configure_timeout: DEFAULT_CONFIGURE_TIMEOUT,
}
}
Expand All @@ -802,6 +804,17 @@ impl<'a> ConfigureInputs<'a> {
self
}

#[cfg(any(
feature = "compute-driver-docker",
feature = "compute-driver-podman",
feature = "compute-driver-vm"
))]
#[must_use]
pub fn with_verified_provider_workload_identity(mut self, enabled: bool) -> Self {
self.verified_provider_workload_identity = Some(enabled);
self
}

/// The `Configure` call for these inputs: the request and its deadline.
#[must_use]
pub fn configure_call(&self) -> ConfigureCall {
Expand Down Expand Up @@ -872,7 +885,7 @@ impl<'a> ConfigureInputs<'a> {
.admission
.and_then(|policy| serde_json::to_string(policy).ok())
.unwrap_or_default(),
verified_provider_workload_identity: None,
verified_provider_workload_identity: self.verified_provider_workload_identity,
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions crates/openshell-gateway/src/launcher/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,15 @@ fn configure_carries_the_gateway_metadata_the_argv_used_to() {
admission: Some(&admission),
sandbox_runtime_image: Some("runtime:1".to_string()),
supervisor_image: None,
verified_provider_workload_identity: Some(true),
configure_timeout: DEFAULT_CONFIGURE_TIMEOUT,
};

let request = inputs.request();

assert_eq!(request.protocol_version, PROTOCOL_VERSION);
assert_eq!(request.verified_provider_workload_identity, Some(true));
assert!(request.required_features.is_empty());
let gateway = request.gateway.unwrap();
assert_eq!(gateway.gateway_port, 8080);
assert_eq!(gateway.bind_address, "127.0.0.1:8080");
Expand Down Expand Up @@ -645,6 +648,7 @@ fn configure_omits_what_the_gateway_does_not_have() {
admission: None,
sandbox_runtime_image: None,
supervisor_image: None,
verified_provider_workload_identity: None,
configure_timeout: DEFAULT_CONFIGURE_TIMEOUT,
};

Expand All @@ -654,6 +658,7 @@ fn configure_omits_what_the_gateway_does_not_have() {
assert!(request.network_trust.is_none());
assert!(request.telemetry.is_none());
assert!(request.resource_admission_policy_json.is_empty());
assert_eq!(request.verified_provider_workload_identity, None);
}

#[tokio::test]
Expand Down
9 changes: 6 additions & 3 deletions crates/openshell-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ impl openshell_server::ComputeDriverFactory for DockerFactory {
context.otlp_config(),
Some(&admission),
)
.with_configure_timeout(context.image_preparation_timeout());
.with_configure_timeout(context.image_preparation_timeout())
.with_verified_provider_workload_identity(context.requires_provider_workload_identity());
// Auto-detection already started the driver; configure that process.
let detected = context.take_detected_driver::<launcher::Started>();
let endpoint = docker::DOCKER
Expand Down Expand Up @@ -488,7 +489,8 @@ impl openshell_server::ComputeDriverFactory for PodmanFactory {
context.otlp_config(),
Some(&admission),
)
.with_configure_timeout(context.image_preparation_timeout());
.with_configure_timeout(context.image_preparation_timeout())
.with_verified_provider_workload_identity(context.requires_provider_workload_identity());
let endpoint = podman::PODMAN
.spawn(
&plan,
Expand Down Expand Up @@ -559,7 +561,8 @@ impl openshell_server::ComputeDriverFactory for VmFactory {
context.otlp_config(),
Some(&admission),
)
.with_configure_timeout(context.image_preparation_timeout());
.with_configure_timeout(context.image_preparation_timeout())
.with_verified_provider_workload_identity(context.requires_provider_workload_identity());
let endpoint = vm::spawn(&plan, context.gateway_log_level(), &inputs).await?;
Ok(openshell_server::ComputeDriverInstance::ManagedRemote(
endpoint,
Expand Down
Loading
Loading