-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shared-defaults: add missing updog to list of network-affected services
We need to regenerate updog's config when the network proxy setting changes. Includes the migration for network's affected-services metadata.
- Loading branch information
Showing
13 changed files
with
110 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
sources/api/migration/migrations/v1.16.1/updog-network-affected/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "updog-network-affected" | ||
version = "0.1.0" | ||
authors = ["Erikson Tung <[email protected]>"] | ||
license = "Apache-2.0 OR MIT" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0" } |
81 changes: 81 additions & 0 deletions
81
sources/api/migration/migrations/v1.16.1/updog-network-affected/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
use migration_helpers::common_migrations::{ | ||
MetadataListReplacement, ReplaceMetadataListsMigration, | ||
}; | ||
use migration_helpers::{migrate, Result}; | ||
use std::process; | ||
|
||
/// We updated the 'affected-services' list metadata for 'settings.network' to include | ||
/// updog. The metadata list need to be restored to the prior value on downgrade and | ||
/// updated to include updog on upgrades. | ||
/// We're trying to match old values for different variants. | ||
fn run() -> Result<()> { | ||
migrate(ReplaceMetadataListsMigration(vec![ | ||
MetadataListReplacement { | ||
setting: "settings.network", | ||
metadata: "affected-services", | ||
old_vals: &["containerd", "host-containerd", "host-containers"], | ||
new_vals: &["containerd", "host-containerd", "host-containers", "updog"], | ||
}, | ||
// For K8S variants | ||
MetadataListReplacement { | ||
setting: "settings.network", | ||
metadata: "affected-services", | ||
old_vals: &[ | ||
"containerd", | ||
"kubernetes", | ||
"host-containerd", | ||
"host-containers", | ||
], | ||
new_vals: &[ | ||
"containerd", | ||
"kubernetes", | ||
"host-containerd", | ||
"host-containers", | ||
"updog", | ||
], | ||
}, | ||
// For the ECS variants | ||
MetadataListReplacement { | ||
setting: "settings.network", | ||
metadata: "affected-services", | ||
old_vals: &[ | ||
"containerd", | ||
"docker", | ||
"ecs", | ||
"host-containerd", | ||
"host-containers", | ||
], | ||
new_vals: &[ | ||
"containerd", | ||
"docker", | ||
"ecs", | ||
"host-containerd", | ||
"host-containers", | ||
"updog", | ||
], | ||
}, | ||
// For *-dev variants | ||
MetadataListReplacement { | ||
setting: "settings.network", | ||
metadata: "affected-services", | ||
old_vals: &["containerd", "docker", "host-containerd", "host-containers"], | ||
new_vals: &[ | ||
"containerd", | ||
"docker", | ||
"host-containerd", | ||
"host-containers", | ||
"updog", | ||
], | ||
}, | ||
])) | ||
} | ||
|
||
// 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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters