-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nvidia settings API for container runtime #3994
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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" |
This file was deleted.
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 - - - - - |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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" } |
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,24 @@ | ||
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); | ||
} | ||
} |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets use the default values to prevent unprivileged pods from accessing all the devices: accept-nvidia-visible-devices-envvar-when-unprivileged = false |
||
|
||
[metadata.settings.kubernetes.nvidia.container-runtime] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR is missing a migration to remove the affected services on a downgrade. |
||
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" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../shared-defaults/nvidia-k8s-container-toolkit.toml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR is missing symlinks for other variants, we need symlinks for:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be safe, and use the
{{default}}
helper, otherwise ifsettings.kubernetes.nvidia.container-runtime.visible-devices-as-volume-mounts
isn't present, the render will fail.