Skip to content

Commit 5bc5aba

Browse files
committed
fix(network): adapt additional CA series to upstream main
Resolve rebase fallout against current upstream main after the series was rebased 214 commits forward: - follow upstream ai-openshell#3110: supervisor→gateway TLS is CA-only, so configure_gateway_tls and its isolation tests drop the client identity - follow upstream tls_secret_names reduction to [String; 1] in the Podman driver while keeping the network trust bundle delivery - port [openshell.supervisor.network] rendering into the openshell.gatewayConfigToml serializer in _toml.tpl - adapt tests to upstream struct/function changes (DriverStartupContext, SandboxRunConfig, IsolationSpecInput, supervisor_pod, VM bootstrap image) - drop conformance-artifact-prefix plumbing removed upstream Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
1 parent 20a172a commit 5bc5aba

12 files changed

Lines changed: 57 additions & 12 deletions

File tree

‎crates/openshell-core/src/grpc_client.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ mod gateway_tls_isolation_tests {
381381
) -> Result<Channel> {
382382
let endpoint = Endpoint::from_shared(format!("https://{address}")).into_diagnostic()?;
383383
configure_gateway_tls(endpoint, pki.ca_pem.clone(), Some(server_name))?
384-
.connect()
385-
.await
386-
.into_diagnostic()
384+
.connect()
385+
.await
386+
.into_diagnostic()
387387
}
388388

389389
#[tokio::test]

‎crates/openshell-driver-docker/src/tests.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ async fn docker_constructor_rejects_proxy_ca_bundle_without_proxy() {
429429
config.upstream_proxy.https_proxy = None;
430430

431431
let Err(error) =
432-
DockerComputeDriver::new("127.0.0.1:17670".parse().unwrap(), "info", &config).await
432+
DockerComputeDriver::new("127.0.0.1:17670".parse().unwrap(), "info", &config, None).await
433433
else {
434434
panic!("constructor must reject incoherent proxy CA configuration before Docker I/O");
435435
};

‎crates/openshell-driver-kubernetes/src/driver.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12439,6 +12439,7 @@ mod tests {
1243912439
sandbox_api_version: Arc::new(OnceCell::new()),
1244012440
lifecycle_gates: Arc::default(),
1244112441
config: managed_config(&[]),
12442+
network_trust_bundle: None,
1244212443
operator_allowlist: None,
1244312444
};
1244412445
let service = crate::ComputeDriverService::new(driver);

‎crates/openshell-driver-kubernetes/src/lifecycle_tests.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ mod lifecycle_reconciliation {
3535
sandbox_api_version: Arc::new(OnceCell::new()),
3636
lifecycle_gates: Arc::default(),
3737
config: KubernetesComputeConfig::default(),
38+
network_trust_bundle: None,
3839
operator_allowlist: None,
3940
};
4041
(driver, steps, Arc::default())

‎crates/openshell-driver-kubernetes/src/sandbox_runtime.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ mod tests {
946946
false,
947947
false,
948948
None,
949+
None,
949950
owner(),
950951
&[
951952
(
@@ -1242,6 +1243,7 @@ mod tests {
12421243
None,
12431244
Some(("openshell-network-additional-ca-gateway-generation", digest)),
12441245
owner(),
1246+
&[],
12451247
)
12461248
.expect("render supervisor Pod with destination trust");
12471249
let spec = pod.spec.expect("Pod spec");

‎crates/openshell-driver-podman/src/container.rs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,6 @@ pub fn build_container_spec_for_image(
12541254
image: &ResolvedPodmanImage,
12551255
supervisor_bin_path: Option<&Path>,
12561256
tls_secret_names: Option<&[String; 1]>,
1257-
network_trust_artifact: Option<&Path>,
12581257
) -> Result<Value, ComputeDriverError> {
12591258
serde_json::to_value(build_base_spec(
12601259
sandbox,
@@ -1974,21 +1973,18 @@ mod tests {
19741973
"sha256:image".into(),
19751974
)
19761975
.unwrap();
1976+
let image = resolved_image("image", "sha256:image", "1000:1001", "/workspace/project");
19771977
let specs = build_isolation_specs(IsolationSpecInput {
19781978
sandbox: &sandbox,
19791979
config: &PodmanComputeConfig::default(),
19801980
token_secret: None,
19811981
resolver_secret: "resolver",
19821982
gpu_devices: None,
1983-
requested_image: "image",
1984-
image_id: "sha256:image",
1985-
image_user: "1000:1001",
1986-
image_env: &[],
1983+
image: &image,
19871984
supervisor_bin: None,
19881985
tls_secrets: None,
19891986
network_trust: Some(&bundle),
19901987
identity: &identity,
1991-
rootless: false,
19921988
})
19931989
.unwrap();
19941990

‎crates/openshell-driver-vm/src/driver.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8434,6 +8434,7 @@ mod tests {
84348434

84358435
let result = VmDriver::new(VmDriverConfig {
84368436
grpc_endpoint: "http://127.0.0.1:8080".to_string(),
8437+
bootstrap_image: "bootstrap:latest".to_string(),
84378438
network_additional_ca_snapshot: Some(supplied_snapshot),
84388439
..Default::default()
84398440
});

‎crates/openshell-server/src/cli.rs‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,43 @@ mod tests {
14841484
use std::net::{IpAddr, Ipv4Addr};
14851485
use std::sync::atomic::{AtomicUsize, Ordering};
14861486

1487+
static ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
1488+
1489+
struct EnvVarGuard {
1490+
key: &'static str,
1491+
original: Option<String>,
1492+
}
1493+
1494+
impl EnvVarGuard {
1495+
#[allow(unsafe_code)]
1496+
fn set(key: &'static str, value: &str) -> Self {
1497+
let original = std::env::var(key).ok();
1498+
// SAFETY: tests serialize environment mutation with ENV_LOCK.
1499+
unsafe { std::env::set_var(key, value) };
1500+
Self { key, original }
1501+
}
1502+
1503+
#[allow(unsafe_code)]
1504+
fn remove(key: &'static str) -> Self {
1505+
let original = std::env::var(key).ok();
1506+
// SAFETY: tests serialize environment mutation with ENV_LOCK.
1507+
unsafe { std::env::remove_var(key) };
1508+
Self { key, original }
1509+
}
1510+
}
1511+
1512+
impl Drop for EnvVarGuard {
1513+
#[allow(unsafe_code)]
1514+
fn drop(&mut self) {
1515+
match self.original.as_deref() {
1516+
// SAFETY: tests serialize environment mutation with ENV_LOCK.
1517+
Some(value) => unsafe { std::env::set_var(self.key, value) },
1518+
// SAFETY: tests serialize environment mutation with ENV_LOCK.
1519+
None => unsafe { std::env::remove_var(self.key) },
1520+
}
1521+
}
1522+
}
1523+
14871524
static REGISTRY_DETECTION_CALLS: AtomicUsize = AtomicUsize::new(0);
14881525
static REJECTING_VALIDATION_CALLS: AtomicUsize = AtomicUsize::new(0);
14891526

‎crates/openshell-server/src/compute/mod.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19465,7 +19465,9 @@ endpoint = { kind = "unix", socket_path = "/run/agent-substrate/isolation.sock"
1946519465
let recovered_runtime = runtime.clone();
1946619466
let mut recovery = tokio::spawn(async move {
1946719467
recovered_runtime
19468-
.recover_persisted_lifecycle_transitions()
19468+
.recover_persisted_lifecycle_transitions(&|_sandbox: &Sandbox| async {
19469+
Ok::<Vec<u8>, String>(Vec::new())
19470+
})
1946919471
.await
1947019472
});
1947119473
tokio::time::timeout(Duration::from_secs(1), driver.start_started.notified())

‎crates/openshell-server/src/lib.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,6 @@ pub trait ComputeDriverFactory: Send + Sync {
13491349
fn supports_network_supervisor_trust(&self) -> bool {
13501350
false
13511351
}
1352-
}
13531352

13541353
async fn build(&self, context: ComputeDriverBuildContext<'_>) -> Result<ComputeDriverInstance>;
13551354
}
@@ -2271,6 +2270,8 @@ mod tests {
22712270
driver_startup: crate::compute::driver_config::DriverStartupContext {
22722271
file: None,
22732272
guest_tls: None,
2273+
network_trust: None,
2274+
network_trust_configured: false,
22742275
gateway_port: 8080,
22752276
gateway_tls_enabled: false,
22762277
endpoint_overrides: &endpoint_overrides,

0 commit comments

Comments
 (0)