diff --git a/Release.toml b/Release.toml index d8ac4baa15c..a9f1cf2d803 100644 --- a/Release.toml +++ b/Release.toml @@ -34,4 +34,5 @@ version = "1.0.7" "migrate_v1.0.8_kubelet-eviction-hard.lz4", "migrate_v1.0.8_kubelet-unsafe-sysctl-kube-reserved.lz4", "migrate_v1.0.8_proxy-affect-host-containers.lz4", + "migrate_v1.0.8_control-container-v0-5-0.lz4", ] diff --git a/sources/Cargo.lock b/sources/Cargo.lock index b6885fbf8ab..98700b0eee5 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -760,6 +760,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "control-container-v0-5-0" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "cookie" version = "0.14.3" diff --git a/sources/Cargo.toml b/sources/Cargo.toml index 985d4bb02ec..4d472ff50f6 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -49,6 +49,7 @@ members = [ "api/migration/migrations/v1.0.8/kubelet-eviction-hard", "api/migration/migrations/v1.0.8/kubelet-unsafe-sysctl-kube-reserved", "api/migration/migrations/v1.0.8/proxy-affect-host-containers", + "api/migration/migrations/v1.0.8/control-container-v0-5-0", "bottlerocket-release", diff --git a/sources/api/migration/migrations/v1.0.8/control-container-v0-5-0/Cargo.toml b/sources/api/migration/migrations/v1.0.8/control-container-v0-5-0/Cargo.toml new file mode 100644 index 00000000000..a2bff3ace6d --- /dev/null +++ b/sources/api/migration/migrations/v1.0.8/control-container-v0-5-0/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "control-container-v0-5-0" +version = "0.1.0" +authors = ["Patrick J.P. Culp "] +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" } diff --git a/sources/api/migration/migrations/v1.0.8/control-container-v0-5-0/src/main.rs b/sources/api/migration/migrations/v1.0.8/control-container-v0-5-0/src/main.rs new file mode 100644 index 00000000000..10fb0325d47 --- /dev/null +++ b/sources/api/migration/migrations/v1.0.8/control-container-v0-5-0/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.4.2"; +const NEW_CONTROL_CTR_TEMPLATE: &str = + "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.5.0"; + +/// We bumped the version of the default control container from v0.4.2 to v0.5.0 +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); + } +}