From d2ac549f353e3aef6ae828d0e19f9864222d903e Mon Sep 17 00:00:00 2001 From: Shikha Vyaghra Date: Wed, 24 Apr 2024 18:21:49 +0000 Subject: [PATCH] migrations: migrate to control container v0.7.11 --- Release.toml | 2 ++ sources/Cargo.lock | 14 ++++++++++ sources/Cargo.toml | 2 ++ .../aws-control-container-v0-7-11/Cargo.toml | 15 +++++++++++ .../aws-control-container-v0-7-11/src/main.rs | 27 +++++++++++++++++++ .../Cargo.toml | 15 +++++++++++ .../src/main.rs | 25 +++++++++++++++++ 7 files changed, 100 insertions(+) create mode 100644 sources/api/migration/migrations/v1.19.5/aws-control-container-v0-7-11/Cargo.toml create mode 100644 sources/api/migration/migrations/v1.19.5/aws-control-container-v0-7-11/src/main.rs create mode 100644 sources/api/migration/migrations/v1.19.5/public-control-container-v0-7-11/Cargo.toml create mode 100644 sources/api/migration/migrations/v1.19.5/public-control-container-v0-7-11/src/main.rs diff --git a/Release.toml b/Release.toml index b3cf623ba50..98b90ab0187 100644 --- a/Release.toml +++ b/Release.toml @@ -285,6 +285,8 @@ version = "1.20.0" "(1.19.4, 1.19.5)" = [ "migrate_v1.19.5_aws-admin-container-v0-11-7.lz4", "migrate_v1.19.5_public-admin-container-v0-11-7.lz4", + "migrate_v1.19.5_aws-control-container-v0-7-11.lz4", + "migrate_v1.19.5_public-control-container-v0-7-11.lz4", ] "(1.19.5, 1.20.0)" = [ "migrate_v1.20.0_prairiedog-config-file-v0-1-0.lz4", diff --git a/sources/Cargo.lock b/sources/Cargo.lock index 7ba4754b5bd..66d28929826 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -619,6 +619,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "aws-control-container-v0-7-11" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "aws-control-container-v0-7-4" version = "0.1.0" @@ -3318,6 +3325,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "public-control-container-v0-7-11" +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 fb39993acf3..a122bff8d49 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -84,6 +84,8 @@ members = [ "api/migration/migrations/v1.20.0/static-pods-services-cfg-v0-1-0", "api/migration/migrations/v1.19.5/aws-admin-container-v0-11-7", "api/migration/migrations/v1.19.5/public-admin-container-v0-11-7", + "api/migration/migrations/v1.19.5/aws-control-container-v0-7-11", + "api/migration/migrations/v1.19.5/public-control-container-v0-7-11", "bloodhound", diff --git a/sources/api/migration/migrations/v1.19.5/aws-control-container-v0-7-11/Cargo.toml b/sources/api/migration/migrations/v1.19.5/aws-control-container-v0-7-11/Cargo.toml new file mode 100644 index 00000000000..8d9a5e1c14a --- /dev/null +++ b/sources/api/migration/migrations/v1.19.5/aws-control-container-v0-7-11/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "aws-control-container-v0-7-11" +version = "0.1.0" +authors = ["Shikha Vyaghra "] +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.19.5/aws-control-container-v0-7-11/src/main.rs b/sources/api/migration/migrations/v1.19.5/aws-control-container-v0-7-11/src/main.rs new file mode 100644 index 00000000000..ab0b7fec060 --- /dev/null +++ b/sources/api/migration/migrations/v1.19.5/aws-control-container-v0-7-11/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.10'"; +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.11'"; + +/// 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.19.5/public-control-container-v0-7-11/Cargo.toml b/sources/api/migration/migrations/v1.19.5/public-control-container-v0-7-11/Cargo.toml new file mode 100644 index 00000000000..09f7325ec5d --- /dev/null +++ b/sources/api/migration/migrations/v1.19.5/public-control-container-v0-7-11/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "public-control-container-v0-7-11" +version = "0.1.0" +authors = ["Shikha Vyaghra "] +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.19.5/public-control-container-v0-7-11/src/main.rs b/sources/api/migration/migrations/v1.19.5/public-control-container-v0-7-11/src/main.rs new file mode 100644 index 00000000000..79086ef92d9 --- /dev/null +++ b/sources/api/migration/migrations/v1.19.5/public-control-container-v0-7-11/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.10"; +const NEW_CONTROL_CTR_SOURCE_VAL: &str = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.7.11"; + +/// 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); + } +}