Skip to content

Commit

Permalink
migration: add migrations for k8 NVIDIA time-slicing
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Sessions <[email protected]>
  • Loading branch information
KCSesh committed Oct 8, 2024
1 parent 4f29a17 commit b599163
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Release.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.24.1"
version = "1.25.0"

[migrations]
"(0.3.1, 0.3.2)" = ["migrate_v0.3.2_admin-container-v0-5-0.lz4"]
Expand Down Expand Up @@ -357,3 +357,6 @@ version = "1.24.1"
"migrate_v1.24.1_aws-control-container-v0-7-16.lz4",
"migrate_v1.24.1_public-control-container-v0-7-16.lz4",
]
"(1.24.1, 1.25.0)" = [
"migrate_v1.25.0_kubelet-device-plugins-time-slicing-settings.lz4",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "kubelet-device-plugins-time-slicing-settings"
version = "0.1.0"
authors = ["Kyle Sessions <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false
# Don't rebuild crate just because of changes to README.
exclude = ["README.md"]


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
migration-helpers.workspace = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use migration_helpers::common_migrations::AddSettingsMigration;
use migration_helpers::{migrate, Result};
use std::process;

/// We added new settings for configuring the NVIDIA k8s device plugin.
fn run() -> Result<()> {
migrate(AddSettingsMigration(&[
"settings.kubelet-device-plugins.nvidia.device-sharing-strategy",
"settings.kubelet-device-plugins.nvidia.time-slicing.replicas",
"settings.kubelet-device-plugins.nvidia.time-slicing.rename-by-default",
"settings.kubelet-device-plugins.nvidia.time-slicing.fail-requests-greater-than-one",
]))
}

// 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);
}
}
1 change: 1 addition & 0 deletions sources/shared-defaults/nvidia-k8s-device-plugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ affected-services = ["nvidia-k8s-device-plugin"]
pass-device-specs = true
device-id-strategy="index"
device-list-strategy="volume-mounts"
device-sharing-strategy="none"

0 comments on commit b599163

Please sign in to comment.