Skip to content

Commit

Permalink
migration: add settings migration for kernel sysctl hugepages
Browse files Browse the repository at this point in the history
Signed-off-by: Yutong Sun <[email protected]>
  • Loading branch information
ytsssun committed Nov 11, 2024
1 parent ad314af commit 785d5db
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Release.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.27.0"
version = "1.28.0"

[migrations]
"(0.3.1, 0.3.2)" = ["migrate_v0.3.2_admin-container-v0-5-0.lz4"]
Expand Down Expand Up @@ -371,3 +371,6 @@ version = "1.27.0"
"(1.26.2, 1.27.0)" = [
"migrate_v1.27.0_aws-config.lz4",
]
"(1.27.0, 1.28.0)" = [
"migrate_v1.28.0_kernel-sysctl-hugepages.lz4"
]
2 changes: 1 addition & 1 deletion Twoliter.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
schema-version = 1
release-version = "1.27.0"
release-version = "1.28.0"

[vendor.bottlerocket]
registry = "public.ecr.aws/bottlerocket"
Expand Down
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 @@ -66,6 +66,7 @@ members = [
"settings-migrations/v1.25.0/aws-control-container-v0-7-17",
"settings-migrations/v1.25.0/public-control-container-v0-7-17",
"settings-migrations/v1.27.0/aws-config",
"settings-migrations/v1.28.0/kernel-sysctl-hugepages",
"settings-plugins/aws-dev",
"settings-plugins/aws-ecs-1",
"settings-plugins/aws-ecs-2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "kernel-sysctl-hugepages"
version = "0.1.0"
authors = ["Yutong Sun <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false
# Don't rebuild crate just because of changes to README.
exclude = ["README.md"]


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
migration-helpers.workspace = true
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 new settings metadata, `metadata.settings.kernel.sysctl.vm/nr_hugepages.setting-generator`
fn run() -> Result<()> {
migrate(AddMetadataMigration(&[SettingMetadata {
metadata: &["setting-generator"],
setting: "settings.kernel.sysctl.vm/nr_hugepages",
}]))
}

// 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 785d5db

Please sign in to comment.