Skip to content

Commit d39d442

Browse files
committed
migration: add MPS device plugin settings
Signed-off-by: Matthew Yeazel <yeazelm@amazon.com>
1 parent 46c5046 commit d39d442

File tree

6 files changed

+71
-5
lines changed

6 files changed

+71
-5
lines changed

Release.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "1.53.0"
1+
version = "1.54.0"
22

33
[migrations]
44
"(0.3.1, 0.3.2)" = ["migrate_v0.3.2_admin-container-v0-5-0.lz4"]
@@ -453,3 +453,6 @@ version = "1.53.0"
453453
]
454454
"(1.51.0, 1.52.0)" = []
455455
"(1.52.0, 1.53.0)" = []
456+
"(1.53.0, 1.54.0)" = [
457+
"migrate_v1.54.0_kubelet-device-plugins-mps-settings.lz4"
458+
]

Twoliter.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
schema-version = 2
2-
release-version = "1.53.0"
2+
release-version = "1.54.0"
33
project-vendor = "Bottlerocket"
44

55
[vendor.bottlerocket]
66
registry = "public.ecr.aws/bottlerocket"
77

88
[sdk]
99
name = "bottlerocket-sdk"
10-
version = "0.66.0"
10+
version = "0.70.0"
1111
vendor = "bottlerocket"
1212

1313
[[kit]]
1414
name = "bottlerocket-kernel-kit"
15-
version = "4.7.1"
15+
version = "4.8.0"
1616
vendor = "bottlerocket"
1717

1818
[[kit]]
1919
name = "bottlerocket-core-kit"
20-
version = "12.2.0"
20+
version = "12.3.0"
2121
vendor = "bottlerocket"

sources/Cargo.lock

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sources/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ members = [
5353
"settings-migrations/v1.51.0/kubernetes-ecr-credential-provider-patterns",
5454
"settings-migrations/v1.51.0/kubernetes-additional-settings",
5555
"settings-migrations/v1.51.0/kubernetes-beta-cpu-manager-policy-options",
56+
"settings-migrations/v1.54.0/kubelet-device-plugins-mps-settings",
5657

5758
"settings-plugins/aws-dev",
5859
"settings-plugins/aws-ecs-2",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "kubelet-device-plugins-mps-settings"
3+
version = "0.1.0"
4+
license = "Apache-2.0 OR MIT"
5+
edition = "2021"
6+
publish = false
7+
exclude = ["README.md"]
8+
9+
[dependencies]
10+
migration-helpers.workspace = true
11+
serde_json.workspace = true
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
use migration_helpers::common_migrations::AddPrefixesMigration;
2+
use migration_helpers::{migrate, Migration, MigrationData, Result};
3+
use std::process;
4+
5+
const DEVICE_SHARING_STRATEGY_SETTING: &str =
6+
"settings.kubelet-device-plugins.nvidia.device-sharing-strategy";
7+
8+
pub struct ReplaceDeviceSharingStrategy;
9+
10+
impl Migration for ReplaceDeviceSharingStrategy {
11+
fn forward(&mut self, input: MigrationData) -> Result<MigrationData> {
12+
println!("ReplaceDeviceSharingStrategy has no work to do on upgrade.");
13+
Ok(input)
14+
}
15+
16+
fn backward(&mut self, mut input: MigrationData) -> Result<MigrationData> {
17+
if let Some(data) = input.data.get_mut(DEVICE_SHARING_STRATEGY_SETTING) {
18+
if let serde_json::Value::String(s) = data {
19+
if s == "mps" {
20+
*data = serde_json::Value::String("none".to_string());
21+
println!("Changed device-sharing-strategy from 'mps' to 'none' on downgrade.");
22+
}
23+
}
24+
}
25+
Ok(input)
26+
}
27+
}
28+
29+
/// We added new settings for configuring NVIDIA MPS (Multi-Process Service)
30+
/// GPU sharing in the device plugin.
31+
fn run() -> Result<()> {
32+
migrate(AddPrefixesMigration(vec![
33+
"settings.kubelet-device-plugins.nvidia.mps",
34+
]))?;
35+
migrate(ReplaceDeviceSharingStrategy)
36+
}
37+
38+
fn main() {
39+
if let Err(e) = run() {
40+
eprintln!("{e}");
41+
process::exit(1);
42+
}
43+
}

0 commit comments

Comments
 (0)