Skip to content

Commit

Permalink
Merge pull request #4345 from vigh-m/neuron-poc-bob
Browse files Browse the repository at this point in the history
Add support for kubernetes device-ownership-from-security-context
  • Loading branch information
vigh-m authored Jan 4, 2025
2 parents de2c1e5 + edadf82 commit eb20992
Show file tree
Hide file tree
Showing 19 changed files with 152 additions and 44 deletions.
6 changes: 5 additions & 1 deletion Release.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.29.0"
version = "1.30.0"

[migrations]
"(0.3.1, 0.3.2)" = ["migrate_v0.3.2_admin-container-v0-5-0.lz4"]
Expand Down Expand Up @@ -380,3 +380,7 @@ version = "1.29.0"
"migrate_v1.28.0_public-control-container-v0-7-18.lz4",
]
"(1.28.0, 1.29.0)" = []
"(1.29.0, 1.30.0)" = [
"migrate_v1.30.0_kubernetes-device-ownership-metadata.lz4",
"migrate_v1.30.0_kubernetes-device-ownership-settings.lz4"
]
2 changes: 1 addition & 1 deletion Twoliter.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
schema-version = 1
release-version = "1.29.0"
release-version = "1.30.0"

[vendor.bottlerocket]
registry = "public.ecr.aws/bottlerocket"
Expand Down
86 changes: 50 additions & 36 deletions sources/Cargo.lock

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ members = [
"settings-migrations/v1.28.0/public-admin-container-v0-11-14",
"settings-migrations/v1.28.0/aws-control-container-v0-7-18",
"settings-migrations/v1.28.0/public-control-container-v0-7-18",
"settings-migrations/v1.30.0/kubernetes-device-ownership-settings",
"settings-migrations/v1.30.0/kubernetes-device-ownership-metadata",

"settings-plugins/aws-dev",
"settings-plugins/aws-ecs-1",
Expand Down Expand Up @@ -147,22 +149,22 @@ version = "0.1.0"

[workspace.dependencies.bottlerocket-modeled-types]
git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk"
tag = "bottlerocket-settings-models-v0.6.0"
version = "0.6.0"
tag = "bottlerocket-settings-models-v0.7.0"
version = "0.7.0"

[workspace.dependencies.bottlerocket-settings-models]
git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk"
tag = "bottlerocket-settings-models-v0.6.0"
version = "0.6.0"
tag = "bottlerocket-settings-models-v0.7.0"
version = "0.7.0"

[workspace.dependencies.bottlerocket-settings-plugin]
git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk"
tag = "bottlerocket-settings-plugin-v0.1.0"
tag = "bottlerocket-settings-models-v0.7.0"
version = "0.1.0"

[workspace.dependencies.settings-extension-oci-defaults]
git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk"
tag = "bottlerocket-settings-models-v0.6.0"
tag = "bottlerocket-settings-models-v0.7.0"
version = "0.1.0"

[profile.release]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "kubernetes-device-ownership-metadata"
version = "0.1.0"
authors = ["Vighnesh Maheshwari <vighmah@amazon.com>"]
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,21 @@
use migration_helpers::common_migrations::AddSettingsMigration;
use migration_helpers::{migrate, Result};
use std::process;

/// We added a new setting, `settings.kubernetes.device-ownership-from-security-context` to allow containers to gain
/// ownership of the requested device
fn run() -> Result<()> {
migrate(AddSettingsMigration(&[
"settings.kubernetes.device-ownership-from-security-context",
]))
}

// 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,15 @@
[package]
name = "kubernetes-device-ownership-settings"
version = "0.1.0"
authors = ["Vighnesh Maheshwari <vighmah@amazon.com>"]
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,22 @@
use migration_helpers::common_migrations::{AddMetadataMigration, SettingMetadata};
use migration_helpers::{migrate, Result};
use std::process;

/// We added a new setting, `settings.kubernetes.device-ownership-from-security-context` to allow containers to gain
/// ownership of the requested device
fn run() -> Result<()> {
migrate(AddMetadataMigration(&[SettingMetadata {
metadata: &["affected-services"],
setting: "settings.kubernetes.device-ownership-from-security-context",
}]))
}

// 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,5 @@
[settings.kubernetes]
device-ownership-from-security-context = false

[metadata.settings.kubernetes.device-ownership-from-security-context]
affected-services = ["containerd"]

0 comments on commit eb20992

Please sign in to comment.