-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nvidia settings API for container runtime
Signed-off-by: Monirul Islam <[email protected]>
- Loading branch information
Showing
13 changed files
with
95 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/nvidia-container-toolkit/nvidia-container-toolkit-config-k8s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[required-extensions] | ||
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}} | ||
|
||
[nvidia-container-cli] | ||
root = "/" | ||
path = "/usr/bin/nvidia-container-cli" | ||
environment = [] | ||
ldconfig = "@/sbin/ldconfig" |
8 changes: 0 additions & 8 deletions
8
packages/nvidia-container-toolkit/nvidia-container-toolkit-config-k8s.toml
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-k8s.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C /etc/nvidia-container-runtime/config.toml - - - - /usr/share/factory/nvidia-container-runtime/nvidia-container-toolkit-config-k8s.toml | ||
d /etc/nvidia-container-runtime - - - - - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
sources/api/migration/migrations/v1.21.0/container-runtime-nvidia-k8s/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "container-runtime-nvidia-k8s" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["Monirul Islam <[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" } |
6 changes: 6 additions & 0 deletions
6
sources/api/migration/migrations/v1.21.0/container-runtime-nvidia-k8s/build.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
22 changes: 22 additions & 0 deletions
22
sources/api/migration/migrations/v1.21.0/container-runtime-nvidia-k8s/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use migration_helpers::common_migrations::{AddPrefixesMigration, NoOpMigration}; | ||
use migration_helpers::{migrate, 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(AddPrefixesMigration(vec!["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); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
sources/models/shared-defaults/nvidia-k8s-container-toolkit.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[settings.kubernetes.nvidia.container-runtime] | ||
visible-devices-as-volume-mounts = false | ||
visible-devices-envvar-when-unprivileged = true | ||
|
||
[metadata.settings.kubernetes.nvidia.container-runtime] | ||
affected-services = ["nvidia-container-toolkit"] | ||
|
||
[services.nvidia-container-toolkit] | ||
configuration-files = ["nvidia-container-toolkit"] | ||
restart-commands = [] | ||
|
||
[configuration-files.nvidia-container-toolkit] | ||
path = "/etc/nvidia-container-runtime/config.toml" | ||
template-path = "/usr/share/factory/nvidia-container-runtime/nvidia-container-toolkit-config-k8s" |
1 change: 1 addition & 0 deletions
1
sources/models/src/aws-k8s-1.30-nvidia/defaults.d/81-nvidia-k8s-container-toolkit.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../shared-defaults/nvidia-k8s-container-toolkit.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters