Skip to content

Commit

Permalink
migrations: add 'aws-k8s-provider-id-gen' migration
Browse files Browse the repository at this point in the history
This migrates the new 'setting-generator' for 'provider-id' in aws-k8s
variants.
  • Loading branch information
etungsten committed Apr 15, 2023
1 parent f168908 commit 3fe1328
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ version = "1.14.0"
"migrate_v1.13.1_aws-profile-cred-provider.lz4",
]
"(1.13.1, 1.13.2)" = []
"(1.13.2, 1.13.3)" = []
"(1.13.2, 1.13.3)" = [
"migrate_v1.13.3_aws-k8s-provider-id-gen.lz4",
]
"(1.13.3, 1.14.0)" = [
"migrate_v1.14.0_kubernetes-gc-percent-type-change.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 @@ -41,6 +41,7 @@ members = [
"api/migration/migrations/v1.13.0/aws-control-container-v0-7-1",
"api/migration/migrations/v1.13.0/public-control-container-v0-7-1",
"api/migration/migrations/v1.13.1/aws-profile-cred-provider",
"api/migration/migrations/v1.13.3/aws-k8s-provider-id-gen",
"api/migration/migrations/v1.14.0/kubernetes-gc-percent-type-change",

"bottlerocket-release",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "aws-k8s-provider-id-gen"
version = "0.1.0"
authors = ["Erikson Tung <etung@amazon.com>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
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"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use migration_helpers::common_migrations::{AddMetadataMigration, SettingMetadata};
use migration_helpers::{migrate, Result};
use std::process;

/// We added a new `setting-generator` metadata for `kubernetes.provider-id`
fn run() -> Result<()> {
migrate(AddMetadataMigration(&[SettingMetadata {
metadata: &["setting-generator"],
setting: "settings.kubernetes.provider-id",
}]))
}

// 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 3fe1328

Please sign in to comment.