From e5c98c34b4a3749eabb18e7c5791cf2d7f6862ca Mon Sep 17 00:00:00 2001 From: ecpullen Date: Mon, 3 Oct 2022 19:53:21 +0000 Subject: [PATCH 1/2] host-containers: control container to v0.6.3 --- sources/models/shared-defaults/aws-host-containers.toml | 2 +- sources/models/shared-defaults/public-host-containers.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/models/shared-defaults/aws-host-containers.toml b/sources/models/shared-defaults/aws-host-containers.toml index b4d91381c59..bfa1dafab50 100644 --- a/sources/models/shared-defaults/aws-host-containers.toml +++ b/sources/models/shared-defaults/aws-host-containers.toml @@ -15,4 +15,4 @@ superpowered = false [metadata.settings.host-containers.control.source] setting-generator = "schnauzer settings.host-containers.control.source" -template = "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.6.1" +template = "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.6.3" diff --git a/sources/models/shared-defaults/public-host-containers.toml b/sources/models/shared-defaults/public-host-containers.toml index bb2d2a26f63..b2a1937006d 100644 --- a/sources/models/shared-defaults/public-host-containers.toml +++ b/sources/models/shared-defaults/public-host-containers.toml @@ -11,4 +11,4 @@ source = "public.ecr.aws/bottlerocket/bottlerocket-admin:v0.9.2" [settings.host-containers.control] enabled = false superpowered = false -source = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.6.1" +source = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.6.3" From 91b7e53f988eea045b3de07e9045178de6f9622c Mon Sep 17 00:00:00 2001 From: ecpullen Date: Mon, 3 Oct 2022 20:49:21 +0000 Subject: [PATCH 2/2] migrations: migrate to control container v0.6.3 --- Release.toml | 2 ++ sources/Cargo.lock | 14 +++++++++ sources/Cargo.toml | 2 ++ .../aws-control-container-v0-6-3/Cargo.toml | 12 ++++++++ .../aws-control-container-v0-6-3/src/main.rs | 29 +++++++++++++++++++ .../Cargo.toml | 12 ++++++++ .../src/main.rs | 27 +++++++++++++++++ 7 files changed, 98 insertions(+) create mode 100644 sources/api/migration/migrations/v1.10.0/aws-control-container-v0-6-3/Cargo.toml create mode 100644 sources/api/migration/migrations/v1.10.0/aws-control-container-v0-6-3/src/main.rs create mode 100644 sources/api/migration/migrations/v1.10.0/public-control-container-v0-6-3/Cargo.toml create mode 100644 sources/api/migration/migrations/v1.10.0/public-control-container-v0-6-3/src/main.rs diff --git a/Release.toml b/Release.toml index 66a36929899..87ffc6b999a 100644 --- a/Release.toml +++ b/Release.toml @@ -149,4 +149,6 @@ version = "1.10.0" "migrate_v1.10.0_kubelet-log-level.lz4", "migrate_v1.10.0_aws-admin-container-v0-9-2.lz4", "migrate_v1.10.0_public-admin-container-v0-9-2.lz4", + "migrate_v1.10.0_aws-control-container-v0-6-3.lz4", + "migrate_v1.10.0_public-control-container-v0-6-3.lz4" ] diff --git a/sources/Cargo.lock b/sources/Cargo.lock index e294f63ec3f..def5d605ba2 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -492,6 +492,13 @@ dependencies = [ "zeroize", ] +[[package]] +name = "aws-control-container-v0-6-3" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "aws-endpoint" version = "0.48.0" @@ -2751,6 +2758,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "public-control-container-v0-6-3" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "quick-xml" version = "0.23.1" diff --git a/sources/Cargo.toml b/sources/Cargo.toml index b63306606ff..e99bb06c03a 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -31,6 +31,8 @@ members = [ "api/migration/migrations/v1.10.0/kubelet-log-level", "api/migration/migrations/v1.10.0/aws-admin-container-v0-9-2", "api/migration/migrations/v1.10.0/public-admin-container-v0-9-2", + "api/migration/migrations/v1.10.0/aws-control-container-v0-6-3", + "api/migration/migrations/v1.10.0/public-control-container-v0-6-3", "bottlerocket-release", diff --git a/sources/api/migration/migrations/v1.10.0/aws-control-container-v0-6-3/Cargo.toml b/sources/api/migration/migrations/v1.10.0/aws-control-container-v0-6-3/Cargo.toml new file mode 100644 index 00000000000..bac02aa59f1 --- /dev/null +++ b/sources/api/migration/migrations/v1.10.0/aws-control-container-v0-6-3/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "aws-control-container-v0-6-3" +version = "0.1.0" +authors = ["Ethan Pullen "] +license = "Apache-2.0 OR MIT" +edition = "2018" +publish = false +# Don't rebuild crate just because of changes to README. +exclude = ["README.md"] + +[dependencies] +migration-helpers = { path = "../../../migration-helpers", version = "0.1.0"} diff --git a/sources/api/migration/migrations/v1.10.0/aws-control-container-v0-6-3/src/main.rs b/sources/api/migration/migrations/v1.10.0/aws-control-container-v0-6-3/src/main.rs new file mode 100644 index 00000000000..61cb9802cf0 --- /dev/null +++ b/sources/api/migration/migrations/v1.10.0/aws-control-container-v0-6-3/src/main.rs @@ -0,0 +1,29 @@ +#![deny(rust_2018_idioms)] + +use migration_helpers::common_migrations::ReplaceTemplateMigration; +use migration_helpers::{migrate, Result}; +use std::process; + +const OLD_CONTROL_CTR_TEMPLATE: &str = + "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.6.1"; +const NEW_CONTROL_CTR_TEMPLATE: &str = + "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.6.3"; + +/// We bumped the version of the default control container +fn run() -> Result<()> { + migrate(ReplaceTemplateMigration { + setting: "settings.host-containers.control.source", + old_template: OLD_CONTROL_CTR_TEMPLATE, + new_template: NEW_CONTROL_CTR_TEMPLATE, + }) +} + +// 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.10.0/public-control-container-v0-6-3/Cargo.toml b/sources/api/migration/migrations/v1.10.0/public-control-container-v0-6-3/Cargo.toml new file mode 100644 index 00000000000..90226e2078a --- /dev/null +++ b/sources/api/migration/migrations/v1.10.0/public-control-container-v0-6-3/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "public-control-container-v0-6-3" +version = "0.1.0" +authors = ["Ethan Pullen "] +license = "Apache-2.0 OR MIT" +edition = "2018" +publish = false +# Don't rebuild crate just because of changes to README. +exclude = ["README.md"] + +[dependencies] +migration-helpers = { path = "../../../migration-helpers", version = "0.1.0"} diff --git a/sources/api/migration/migrations/v1.10.0/public-control-container-v0-6-3/src/main.rs b/sources/api/migration/migrations/v1.10.0/public-control-container-v0-6-3/src/main.rs new file mode 100644 index 00000000000..b0b1913b00b --- /dev/null +++ b/sources/api/migration/migrations/v1.10.0/public-control-container-v0-6-3/src/main.rs @@ -0,0 +1,27 @@ +#![deny(rust_2018_idioms)] + +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.6.1"; +const NEW_CONTROL_CTR_SOURCE_VAL: &str = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.6.3"; + +/// 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); + } +}