Skip to content

Commit

Permalink
Add missing symlink and metadata migration
Browse files Browse the repository at this point in the history
Signed-off-by: Yutong Sun <[email protected]>
  • Loading branch information
ytsssun committed Jun 11, 2024
1 parent 32c2ad7 commit ab28cf2
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,6 @@ version = "1.21.0"
"migrate_v1.21.0_pod-infra-container-image-remove-settings-generator.lz4",
"migrate_v1.21.0_pod-infra-container-image-affected-services.lz4",
"migrate_v1.21.0_pod-infra-container-image-services.lz4",
"migrate_v1.21.0_container-runtime-nvidia-k8s.lz4"
"migrate_v1.21.0_container-runtime-nvidia-k8s.lz4",
"migrate_v1.21.0_container-runtime-nvidia-k8s-metadata.lz4",
]
1 change: 1 addition & 0 deletions packages/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.patch.bz2
*.src.rpm
*.zip
*.rpm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
kubernetes = "v1"

+++
accept-nvidia-visible-devices-as-volume-mounts = {{settings.kubernetes.nvidia.container-runtime.visible-devices-as-volume-mounts}}
accept-nvidia-visible-devices-envvar-when-unprivileged = {{settings.kubernetes.nvidia.container-runtime.visible-devices-envvar-when-unprivileged}}
accept-nvidia-visible-devices-as-volume-mounts = {{default true settings.kubernetes.nvidia.container-runtime.visible-devices-as-volume-mounts}}
accept-nvidia-visible-devices-envvar-when-unprivileged = {{default false settings.kubernetes.nvidia.container-runtime.visible-devices-envvar-when-unprivileged}}

[nvidia-container-cli]
root = "/"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "container-runtime-nvidia-k8s-metadata"
version = "0.1.0"
edition = "2021"
authors = ["Yutong Sun <[email protected]>"]
license = "Apache-2.0 OR MIT"
publish = false
# Don't rebuild crate just because of changes to README.
exclude = ["README.md"]

[dependencies]
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0"}

[build-dependencies]
bottlerocket-variant = { version = "0.1", path = "../../../../../bottlerocket-variant" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use bottlerocket_variant::Variant;

fn main() {
let variant = Variant::from_env().unwrap();
variant.emit_cfgs();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use migration_helpers::common_migrations::{AddMetadataMigration, NoOpMigration, SettingMetadata};
use migration_helpers::migrate;
use migration_helpers::Result;
use std::process;

/// We added a new setting for configuring container runtime (containerd) settings only for NVIDIA k8s variants.
fn run() -> Result<()> {
if cfg!(variant_family = "aws-k8s") && cfg!(variant_flavor = "nvidia") {
migrate(AddMetadataMigration(&[SettingMetadata {
metadata: &["affected-services"],
setting: "settings.kubernetes.nvidia.container-runtime",
}]))
} else {
migrate(NoOpMigration)
}
}

// Returning a Result from main makes it print a Debug representation of the error, but with Snafu
// we have nice Display representations of the error, so we wrap "main" (run) and print any error.
// https://github.com/shepmaster/snafu/issues/110
fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}

0 comments on commit ab28cf2

Please sign in to comment.