diff --git a/Release.toml b/Release.toml index f62f6f1611f..cbd6d15d52a 100644 --- a/Release.toml +++ b/Release.toml @@ -315,4 +315,5 @@ version = "1.21.0" "(1.20.0, 1.20.1)" = [] "(1.20.1, 1.21.0)" = [ "migrate_v1.21.0_pluto-remove-generators-v0-1-0.lz4", + "migrate_v1.21.0_k8s-reserved-cpus-v0-1-0.lz4", ] diff --git a/sources/Cargo.lock b/sources/Cargo.lock index 98f4a6bbcf2..268baa57cc9 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -2279,6 +2279,13 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k8s-reserved-cpus-v0-1-0" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "language-tags" version = "0.3.2" diff --git a/sources/Cargo.toml b/sources/Cargo.toml index 9569aa6f62b..de6b68df4cc 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -24,6 +24,7 @@ members = [ # "api/migration/migrations/vX.Y.Z/..." # (all previous migrations archived; add new ones after this line) "api/migration/migrations/v1.21.0/pluto-remove-generators-v0-1-0", + "api/migration/migrations/v1.21.0/k8s-reserved-cpus-v0-1-0", "bloodhound", diff --git a/sources/api/migration/migrations/v1.21.0/k8s-reserved-cpus-v0-1-0/Cargo.toml b/sources/api/migration/migrations/v1.21.0/k8s-reserved-cpus-v0-1-0/Cargo.toml new file mode 100644 index 00000000000..4ec663aaa3e --- /dev/null +++ b/sources/api/migration/migrations/v1.21.0/k8s-reserved-cpus-v0-1-0/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "k8s-reserved-cpus-v0-1-0" +version = "0.1.0" +authors = ["James Masson "] +license = "Apache-2.0 OR MIT" +edition = "2021" +publish = false + +[dependencies] +migration-helpers = { path = "../../../migration-helpers", version = "0.1.0" } diff --git a/sources/api/migration/migrations/v1.21.0/k8s-reserved-cpus-v0-1-0/src/main.rs b/sources/api/migration/migrations/v1.21.0/k8s-reserved-cpus-v0-1-0/src/main.rs new file mode 100644 index 00000000000..54cba0056d5 --- /dev/null +++ b/sources/api/migration/migrations/v1.21.0/k8s-reserved-cpus-v0-1-0/src/main.rs @@ -0,0 +1,18 @@ +use migration_helpers::common_migrations::AddSettingsMigration; +use migration_helpers::{migrate, Result}; +use std::process; + +/// Add the option to set Kubernetes reserved-cpus +fn run() -> Result<()> { + migrate(AddSettingsMigration(&["settings.kubernetes.reserved-cpus"])) +} + +// 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); + } +}