From cd22011e526b9beaf6edcf9031d3385f08eac168 Mon Sep 17 00:00:00 2001 From: Todd Neal Date: Tue, 30 Jul 2024 20:04:03 +0000 Subject: [PATCH] update to bottlerocket-settings-models v0.2.0 This adds support for hostname-override-source, so we add a migration as well. Updates the external cloud provider default to use a hostname-override-source of private-dns-name to match the current behavior. --- sources/Cargo.lock | 63 ++++++++++--------- sources/Cargo.toml | 11 ++-- .../add-hostname-override-source/Cargo.toml | 10 +++ .../add-hostname-override-source/src/main.rs | 21 +++++++ ...ubernetes-aws-external-cloud-provider.toml | 1 + 5 files changed, 73 insertions(+), 33 deletions(-) create mode 100644 sources/settings-migrations/v1.21.0/add-hostname-override-source/Cargo.toml create mode 100644 sources/settings-migrations/v1.21.0/add-hostname-override-source/src/main.rs diff --git a/sources/Cargo.lock b/sources/Cargo.lock index b8bfbf3d0dd..804385905c3 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -50,6 +50,13 @@ dependencies = [ "core_extensions", ] +[[package]] +name = "add-hostname-override-source" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "addr2line" version = "0.21.0" @@ -327,7 +334,7 @@ dependencies = [ [[package]] name = "bottlerocket-model-derive" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "darling 0.20.8", "quote", @@ -336,8 +343,8 @@ dependencies = [ [[package]] name = "bottlerocket-modeled-types" -version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +version = "0.2.0" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "base64", "bottlerocket-scalar", @@ -370,7 +377,7 @@ dependencies = [ [[package]] name = "bottlerocket-scalar" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "serde", "serde_plain", @@ -379,7 +386,7 @@ dependencies = [ [[package]] name = "bottlerocket-scalar-derive" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-scalar", "darling 0.20.8", @@ -403,8 +410,8 @@ dependencies = [ [[package]] name = "bottlerocket-settings-models" -version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +version = "0.2.0" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -450,7 +457,7 @@ dependencies = [ [[package]] name = "bottlerocket-settings-sdk" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "argh", "bottlerocket-template-helper", @@ -463,7 +470,7 @@ dependencies = [ [[package]] name = "bottlerocket-string-impls-for" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "serde", ] @@ -471,7 +478,7 @@ dependencies = [ [[package]] name = "bottlerocket-template-helper" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "darling 0.20.8", "proc-macro2", @@ -2113,7 +2120,7 @@ dependencies = [ [[package]] name = "settings-extension-autoscaling" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2126,7 +2133,7 @@ dependencies = [ [[package]] name = "settings-extension-aws" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2139,7 +2146,7 @@ dependencies = [ [[package]] name = "settings-extension-bootstrap-containers" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2152,7 +2159,7 @@ dependencies = [ [[package]] name = "settings-extension-cloudformation" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2165,7 +2172,7 @@ dependencies = [ [[package]] name = "settings-extension-container-registry" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2178,7 +2185,7 @@ dependencies = [ [[package]] name = "settings-extension-container-runtime" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2191,7 +2198,7 @@ dependencies = [ [[package]] name = "settings-extension-dns" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2204,7 +2211,7 @@ dependencies = [ [[package]] name = "settings-extension-ecs" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2217,7 +2224,7 @@ dependencies = [ [[package]] name = "settings-extension-host-containers" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2230,7 +2237,7 @@ dependencies = [ [[package]] name = "settings-extension-kernel" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2243,7 +2250,7 @@ dependencies = [ [[package]] name = "settings-extension-metrics" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2256,7 +2263,7 @@ dependencies = [ [[package]] name = "settings-extension-motd" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-settings-sdk", "bottlerocket-string-impls-for", @@ -2268,7 +2275,7 @@ dependencies = [ [[package]] name = "settings-extension-network" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2281,7 +2288,7 @@ dependencies = [ [[package]] name = "settings-extension-ntp" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2294,7 +2301,7 @@ dependencies = [ [[package]] name = "settings-extension-oci-defaults" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2308,7 +2315,7 @@ dependencies = [ [[package]] name = "settings-extension-oci-hooks" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2321,7 +2328,7 @@ dependencies = [ [[package]] name = "settings-extension-pki" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", @@ -2334,7 +2341,7 @@ dependencies = [ [[package]] name = "settings-extension-updates" version = "0.1.0" -source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.1.0#c5dfef43961795c1e7781ffc55e090883ff326d7" +source = "git+https://github.com/bottlerocket-os/bottlerocket-settings-sdk?tag=bottlerocket-settings-models-v0.2.0#848b3153922c5202e4f38c428b7572a9ee313f3f" dependencies = [ "bottlerocket-model-derive", "bottlerocket-modeled-types", diff --git a/sources/Cargo.toml b/sources/Cargo.toml index 2e0593de267..b15d2edc9d7 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -40,6 +40,7 @@ members = [ "settings-migrations/v1.21.0/pod-infra-container-image-remove-settings-generator", "settings-migrations/v1.21.0/pod-infra-container-image-services", "settings-migrations/v1.21.0/k8s-reserved-cpus-v0-1-0", + "settings-migrations/v1.21.0/add-hostname-override-source", "settings-plugins/aws-dev", "settings-plugins/aws-ecs-1", @@ -60,13 +61,13 @@ version = "0.1.0" [workspace.dependencies.bottlerocket-modeled-types] git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk" -tag = "bottlerocket-settings-models-v0.1.0" -version = "0.1.0" +tag = "bottlerocket-settings-models-v0.2.0" +version = "0.2.0" [workspace.dependencies.bottlerocket-settings-models] git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk" -tag = "bottlerocket-settings-models-v0.1.0" -version = "0.1.0" +tag = "bottlerocket-settings-models-v0.2.0" +version = "0.2.0" [workspace.dependencies.bottlerocket-settings-plugin] git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk" @@ -75,7 +76,7 @@ version = "0.1.0" [workspace.dependencies.settings-extension-oci-defaults] git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk" -tag = "bottlerocket-settings-models-v0.1.0" +tag = "bottlerocket-settings-models-v0.2.0" version = "0.1.0" [profile.release] diff --git a/sources/settings-migrations/v1.21.0/add-hostname-override-source/Cargo.toml b/sources/settings-migrations/v1.21.0/add-hostname-override-source/Cargo.toml new file mode 100644 index 00000000000..ae927c8b855 --- /dev/null +++ b/sources/settings-migrations/v1.21.0/add-hostname-override-source/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "add-hostname-override-source" +version = "0.1.0" +authors = ["Todd Neal "] +license = "Apache-2.0 OR MIT" +edition = "2018" +publish = false + +[dependencies] +migration-helpers = { path = "../../../api/migration/migration-helpers", version = "0.1.0" } diff --git a/sources/settings-migrations/v1.21.0/add-hostname-override-source/src/main.rs b/sources/settings-migrations/v1.21.0/add-hostname-override-source/src/main.rs new file mode 100644 index 00000000000..4c7ee3d516a --- /dev/null +++ b/sources/settings-migrations/v1.21.0/add-hostname-override-source/src/main.rs @@ -0,0 +1,21 @@ +use migration_helpers::common_migrations::AddSettingsMigration; +use migration_helpers::{migrate, Result}; +use std::process; + +/// We added one new settings for configuring the override method for the method used to determine +/// the node +fn run() -> Result<()> { + migrate(AddSettingsMigration(&[ + "settings.kubernetes.hostname-override-source", + ])) +} + +// 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); + } +} diff --git a/sources/shared-defaults/kubernetes-aws-external-cloud-provider.toml b/sources/shared-defaults/kubernetes-aws-external-cloud-provider.toml index 016b643eaa4..6a57ea8c51d 100644 --- a/sources/shared-defaults/kubernetes-aws-external-cloud-provider.toml +++ b/sources/shared-defaults/kubernetes-aws-external-cloud-provider.toml @@ -1,2 +1,3 @@ [settings.kubernetes] cloud-provider = "external" +hostname-override-source = "private-dns-name"