Skip to content

Commit

Permalink
migrations: add add-static-pods migration
Browse files Browse the repository at this point in the history
Adds a new migration for new k8s static-pods settings
  • Loading branch information
etungsten committed Feb 17, 2021
1 parent d0864c3 commit de6926b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ version = "1.0.5"
"migrate_v1.0.5_add-proxy-restart.lz4",
"migrate_v1.0.5_add-proxy-services.lz4"
]
"(1.0.5, 1.0.6)" = ["migrate_v1.0.6_metricdog-init.lz4"]
"(1.0.5, 1.0.6)" = ["migrate_v1.0.6_metricdog-init.lz4", "migrate_v1.0.6_add-static-pods.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 @@ -39,6 +39,7 @@ members = [
"api/migration/migrations/v1.0.5/add-proxy-restart",
"api/migration/migrations/v1.0.5/add-proxy-services",
"api/migration/migrations/v1.0.6/metricdog-init",
"api/migration/migrations/v1.0.6/add-static-pods",

"bottlerocket-release",

Expand Down
12 changes: 12 additions & 0 deletions sources/api/migration/migrations/v1.0.6/add-static-pods/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "add-static-pods"
version = "0.1.0"
authors = ["Erikson Tung <etung@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,24 @@
#![deny(rust_2018_idioms)]

use migration_helpers::common_migrations::AddPrefixesMigration;
use migration_helpers::{migrate, Result};
use std::process;

/// We added new settings for defining k8s static pods.
/// Remove `settings.kubernetes.static-pods`, `services.static-pods` prefixes when we downgrade.
fn run() -> Result<()> {
migrate(AddPrefixesMigration(vec![
"settings.kubernetes.static-pods",
"services.static-pods",
]))
}

// 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 de6926b

Please sign in to comment.