Skip to content

Commit c6b64dd

Browse files
committed
fix(sandbox): align projected bootstrap bundle
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
1 parent 0d749dc commit c6b64dd

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

  • crates/openshell-sandbox/src

‎crates/openshell-sandbox/src/main.rs‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use tracing_subscriber::{Layer, layer::SubscriberExt, util::SubscriberInitExt};
2424
const COPY_SELF_SUBCOMMAND: &str = "copy-self";
2525
const BOOTSTRAP_SUBCOMMAND: &str = "bootstrap";
2626
const SEED_WORKSPACE_SUBCOMMAND: &str = "seed-workspace";
27+
const KUBERNETES_BOOTSTRAP_SECRET_FILES: [&str; 3] = ["boundary.json", "tls.crt", "tls.key"];
2728
#[cfg(target_os = "linux")]
2829
const BOOTSTRAP_INPUT_ROOT: &str = "/.openshell/bootstrap-input";
2930
#[cfg(target_os = "linux")]
@@ -1656,7 +1657,7 @@ fn stage_kubernetes_bootstrap_at(source: &Path, runtime: &Path, state: &Path) ->
16561657
let bundle_final = state.join("bootstrap");
16571658
fs::create_dir(&bundle_tmp).into_diagnostic()?;
16581659
fs::set_permissions(&bundle_tmp, fs::Permissions::from_mode(0o700)).into_diagnostic()?;
1659-
for name in ["boundary.json", "tls.crt", "tls.key", "client-ca.crt"] {
1660+
for name in KUBERNETES_BOOTSTRAP_SECRET_FILES {
16601661
copy_projected_secret_file(source, name, &bundle_tmp.join(name), 0o600)?;
16611662
}
16621663
fs::rename(&bundle_tmp, &bundle_final).into_diagnostic()?;
@@ -1918,13 +1919,8 @@ mod tests {
19181919
std::fs::create_dir(&source).unwrap();
19191920
let revision = source.join("..2026_09_04_00_00_00");
19201921
std::fs::create_dir(&revision).unwrap();
1921-
for (name, contents) in [
1922-
("boundary.json", b"{}".as_slice()),
1923-
("tls.crt", b"certificate".as_slice()),
1924-
("tls.key", b"private-key".as_slice()),
1925-
("client-ca.crt", b"client-ca".as_slice()),
1926-
] {
1927-
std::fs::write(revision.join(name), contents).unwrap();
1922+
for name in KUBERNETES_BOOTSTRAP_SECRET_FILES {
1923+
std::fs::write(revision.join(name), format!("contents-{name}")).unwrap();
19281924
std::os::unix::fs::symlink(format!("..data/{name}"), source.join(name)).unwrap();
19291925
}
19301926
std::os::unix::fs::symlink(revision.file_name().unwrap(), source.join("..data")).unwrap();
@@ -1940,7 +1936,7 @@ mod tests {
19401936
& 0o777,
19411937
0o500
19421938
);
1943-
for name in ["boundary.json", "tls.crt", "tls.key", "client-ca.crt"] {
1939+
for name in KUBERNETES_BOOTSTRAP_SECRET_FILES {
19441940
let staged = state.join("bootstrap").join(name);
19451941
assert_eq!(
19461942
std::fs::read(&staged).unwrap(),

0 commit comments

Comments
 (0)