Skip to content

Commit

Permalink
Merge pull request #1441 from jpculp/control-container-migrate-v0.5.0
Browse files Browse the repository at this point in the history
migrations: control-container v0.5.0 default version migration
  • Loading branch information
jpculp authored Apr 7, 2021
2 parents 8223e57 + f45692a commit 02d4a91
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
7 changes: 7 additions & 0 deletions sources/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "control-container-v0-5-0"
version = "0.1.0"
authors = ["Patrick J.P. Culp <jpculp@amazon.com>"]
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" }
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 02d4a91

Please sign in to comment.