From b46c719afa4998e77fc6617d011f06fd30cc2251 Mon Sep 17 00:00:00 2001 From: Kyle Sessions Date: Tue, 7 May 2024 01:20:59 +0000 Subject: [PATCH] migrations: migrate to control container v0.7.12 Signed-off-by: Kyle Sessions --- Release.toml | 2 ++ sources/Cargo.lock | 14 ++++++++++ sources/Cargo.toml | 2 ++ .../aws-control-container-v0-7-12/Cargo.toml | 16 +++++++++++ .../aws-control-container-v0-7-12/src/main.rs | 27 +++++++++++++++++++ .../Cargo.toml | 16 +++++++++++ .../src/main.rs | 25 +++++++++++++++++ 7 files changed, 102 insertions(+) create mode 100644 sources/api/migration/migrations/v1.20.0/aws-control-container-v0-7-12/Cargo.toml create mode 100644 sources/api/migration/migrations/v1.20.0/aws-control-container-v0-7-12/src/main.rs create mode 100644 sources/api/migration/migrations/v1.20.0/public-control-container-v0-7-12/Cargo.toml create mode 100644 sources/api/migration/migrations/v1.20.0/public-control-container-v0-7-12/src/main.rs diff --git a/Release.toml b/Release.toml index c3c68b61116..cb202e8fca6 100644 --- a/Release.toml +++ b/Release.toml @@ -309,4 +309,6 @@ version = "1.20.0" "migrate_v1.20.0_container-runtime-metadata-nvidia.lz4", "migrate_v1.20.0_aws-admin-container-v0-11-8.lz4", "migrate_v1.20.0_public-admin-container-v0-11-8.lz4", + "migrate_v1.20.0_aws-control-container-v0-7-12.lz4", + "migrate_v1.20.0_public-control-container-v0-7-12.lz4", ] diff --git a/sources/Cargo.lock b/sources/Cargo.lock index ad6b62cc086..be369b36f2b 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -633,6 +633,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "aws-control-container-v0-7-12" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "aws-control-container-v0-7-4" version = "0.1.0" @@ -3355,6 +3362,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "public-control-container-v0-7-12" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "public-control-container-v0-7-4" version = "0.1.0" diff --git a/sources/Cargo.toml b/sources/Cargo.toml index 156dacf43a6..1509bc49aca 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -88,6 +88,8 @@ members = [ "api/migration/migrations/v1.20.0/container-runtime-metadata-nvidia", "api/migration/migrations/v1.20.0/aws-admin-container-v0-11-8", "api/migration/migrations/v1.20.0/public-admin-container-v0-11-8", + "api/migration/migrations/v1.20.0/aws-control-container-v0-7-12", + "api/migration/migrations/v1.20.0/public-control-container-v0-7-12", "bloodhound", diff --git a/sources/api/migration/migrations/v1.20.0/aws-control-container-v0-7-12/Cargo.toml b/sources/api/migration/migrations/v1.20.0/aws-control-container-v0-7-12/Cargo.toml new file mode 100644 index 00000000000..aa1bf3a3cf7 --- /dev/null +++ b/sources/api/migration/migrations/v1.20.0/aws-control-container-v0-7-12/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "aws-control-container-v0-7-12" +version = "0.1.0" +authors = ["Kyle Sessions "] +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 = { path = "../../../migration-helpers", version = "0.1.0"} + diff --git a/sources/api/migration/migrations/v1.20.0/aws-control-container-v0-7-12/src/main.rs b/sources/api/migration/migrations/v1.20.0/aws-control-container-v0-7-12/src/main.rs new file mode 100644 index 00000000000..0f904363b14 --- /dev/null +++ b/sources/api/migration/migrations/v1.20.0/aws-control-container-v0-7-12/src/main.rs @@ -0,0 +1,27 @@ +use migration_helpers::common_migrations::ReplaceSchnauzerMigration; +use migration_helpers::{migrate, Result}; +use std::process; + +const OLD_CONTROL_CTR_CMDLINE: &str = + "schnauzer-v2 render --requires 'aws@v1(helpers=[ecr-prefix])' --template '{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.7.11'"; +const NEW_CONTROL_CTR_CMDLINE: &str = + "schnauzer-v2 render --requires 'aws@v1(helpers=[ecr-prefix])' --template '{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.7.12'"; + +/// We bumped the version of the default control container +fn run() -> Result<()> { + migrate(ReplaceSchnauzerMigration { + setting: "settings.host-containers.control.source", + old_schnauzer_cmdline: OLD_CONTROL_CTR_CMDLINE, + new_schnauzer_cmdline: NEW_CONTROL_CTR_CMDLINE, + }) +} + +// 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); + } +} diff --git a/sources/api/migration/migrations/v1.20.0/public-control-container-v0-7-12/Cargo.toml b/sources/api/migration/migrations/v1.20.0/public-control-container-v0-7-12/Cargo.toml new file mode 100644 index 00000000000..71bde12e104 --- /dev/null +++ b/sources/api/migration/migrations/v1.20.0/public-control-container-v0-7-12/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "public-control-container-v0-7-12" +version = "0.1.0" +authors = ["Kyle Sessions "] +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 = { path = "../../../migration-helpers", version = "0.1.0"} + diff --git a/sources/api/migration/migrations/v1.20.0/public-control-container-v0-7-12/src/main.rs b/sources/api/migration/migrations/v1.20.0/public-control-container-v0-7-12/src/main.rs new file mode 100644 index 00000000000..e2b5ede4d89 --- /dev/null +++ b/sources/api/migration/migrations/v1.20.0/public-control-container-v0-7-12/src/main.rs @@ -0,0 +1,25 @@ +use migration_helpers::common_migrations::ReplaceStringMigration; +use migration_helpers::{migrate, Result}; +use std::process; + +const OLD_CONTROL_CTR_SOURCE_VAL: &str = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.7.11"; +const NEW_CONTROL_CTR_SOURCE_VAL: &str = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.7.12"; + +/// We bumped the version of the default control container +fn run() -> Result<()> { + migrate(ReplaceStringMigration { + setting: "settings.host-containers.control.source", + old_val: OLD_CONTROL_CTR_SOURCE_VAL, + new_val: NEW_CONTROL_CTR_SOURCE_VAL, + }) +} + +// 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); + } +}