Repository navigation
ntp: use per-server chrony settings - #4923
xiaotianlyu wants to merge 5 commits into
Conversation
d2acce8 to
97ae203
Compare
| # chrony log categories, rendered as the `log` line. | ||
| logging = ["measurements", "statistics", "tracking"] |
There was a problem hiding this comment.
logging should be opt-in, not on by default
| # chrony log categories, rendered as the `log` line. | |
| logging = ["measurements", "statistics", "tracking"] |
There was a problem hiding this comment.
Updated, thanks!
| # chrony log categories, rendered as the `log` line. | ||
| logging = ["measurements", "statistics", "tracking"] |
There was a problem hiding this comment.
logging should be opt-in, not on by default
| # chrony log categories, rendered as the `log` line. | |
| logging = ["measurements", "statistics", "tracking"] |
There was a problem hiding this comment.
Updated, thanks! Chrony file logging is now opt-in and is no longer enabled in the shared defaults.
cc4d647 to
f0e9cba
Compare
| Ok(input) | ||
| } | ||
|
|
||
| fn backward(&mut self, mut input: MigrationData) -> Result<MigrationData> { |
There was a problem hiding this comment.
Lets write a migration helper for list-to-named-map conversion and use that in the backward and forward migrations.
There was a problem hiding this comment.
Thank you! I added shared helpers for list-to-named-map and named-map-to-list conversion, and updated both the forward and backward NTP migration to use them.
1887701 to
9143cf0
Compare
There was a problem hiding this comment.
this commit just removes lines that were added in the previous commit. Can you please squash the 2 commits together instead ?
There was a problem hiding this comment.
Thank you! Updated
| /// Converts a list setting into scalar fields below `prefix.<name>.<field>`. | ||
| /// | ||
| /// The converter owns the value-specific mapping. Returning `None` leaves the input unchanged. | ||
| /// This helper only changes data; callers must migrate related metadata separately. |
There was a problem hiding this comment.
This should go in the commit which added the migration helper.
There was a problem hiding this comment.
it looks like we're duplicating logic here and in the shared helper.
you could make key-walkers generic over the value type and expose them like:
pub fn read_flattened_named_map<V: Clone>(data: &HashMap<String, V>, prefix: &[&str])
-> Result<Option<BTreeMap<String, BTreeMap<String, V>>>>
pub fn replace_flattened_named_map<V: Clone>(data: &mut HashMap<String, V>, prefix: &[&str], replacement: &BTreeMap<String, BTreeMap<String, V>>) -> Result<()>Then main.rs calls the same functions for both data (V = Value) and metadata (V = Metadata), deleting all three hand-rolled routines and getting Key-based parsing on metadata for free.
There was a problem hiding this comment.
Makes sense! Thank you, I updated the helper
9143cf0 to
e6e731d
Compare
Signed-off-by: Melody Lyu <tianlyu@amazon.com>
Signed-off-by: Melody Lyu <tianlyu@amazon.com>
Configure the link-local time source as a preferred server with fixed polling, and replace the legacy Amazon pool with time.aws.com. Add support for configurable chrony logging while leaving it disabled by default. Signed-off-by: Melody Lyu <tianlyu@amazon.com>
78314a4 to
9a45bf1
Compare
Signed-off-by: Melody Lyu <tianlyu@amazon.com>
Convert legacy NTP server lists and shared options into named per-server settings during upgrade. Use the shared named-map migration helper. Restore the legacy server list and common options during rollback. Register the migration for the 1.66.0 to 1.67.0 transition. Signed-off-by: Melody Lyu <tianlyu@amazon.com>
9a45bf1 to
b88ee61
Compare
|
Are you able to test custom server configurations or configurations with NTP is turned off being preserved after an upgrade? I want to test to see if custom configuration is preserved or if this would affect users who remove AWS servers on purpose if they upgrade. |
Description of changes:
Updates the shared NTP defaults to use named per-server chrony settings:
169.254.169.123as a preferredserverpolled every 16 seconds;2.amazon.pool.ntp.orgwith thetime.aws.compool; andsettings.ntp.logging; loggingis disabled by default.
Adds a datastore migration for existing nodes. On upgrade, it converts the old
settings.ntp.time-serverslist and shared options into named servers. The new recommended settings are applied only when the old configuration matches the previous defaults; customer-configured servers and options are preserved.On rollback, the migration converts named servers back into a list and shared options that the old API can read. Since the old format supports only one shared options list, rollback preserves options that are common to all named servers.
The migration is required because Storewolf otherwise retains the old list while adding the new named keys. This was reproduced during upgrade as:
The migration is registered for the
1.66.0 -> 1.67.0transition.This change updates Bottlerocket to:
0.30.0;0.80.0;17.1.0;9.3.0.Testing done:
Local tests:
cargo test -p ntp-time-servers: 12 passedcargo test -p migration-helpers: 32 passedcargo check -p settings-plugin-aws-k8s: passedcargo clippy -p ntp-time-servers --all-targets -- -D warnings: passedcargo clippy -p migration-helpers --all-targets -- -D warnings: passedcargo fmt --manifest-path sources/Cargo.toml --all -- --check: passedgit diff --check: passedMigration tests cover:
Full image upgrade and rollback test:
aws-k8s-1.32x86_641.67.0image using bottlerocket-settings-models0.30.0, SDK0.80.0, core-kit17.1.0, and kernel-kit9.3.0;migrate_v1.67.0_ntp-time-servers.lz4;1.66.0node with the old server list;1.66.0to the test1.67.0image;1.66.0.After upgrade:
the migrator journal reported that the NTP migration completed successfully;
apiclient get settings.ntpreturned only the namedlink-localandamazon-poolentries, with no duplicate-field error;/etc/chrony.confrendered:no
logdirective was rendered by default;changing logging to
["tracking"]renderedlog tracking;changing logging to
[]removed thelogdirective;chronyd was active with
NRestarts=0.After rollback:
1.66.0;169.254.169.123andtime.aws.comin the restored list;iburstoption;NRestarts=0.Fresh install test:
aws-k8s-1.32x86_641.67.0image from the final PR commit;apiclient get settings.ntpreturned the default namedlink-localandamazon-poolservers;/etc/chrony.confrendered the expectedserverandpooldirectives with nologdirective by default;169.254.169.123about five seconds after boot;1.316646seconds;NRestarts=0.Related PRs:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed
under the terms of both the Apache License, version 2.0, and the MIT license.