Skip to content

chrony: render per-server time source configuration - #1030

Draft
xiaotianlyu wants to merge 1 commit into
bottlerocket-os:developfrom
xiaotianlyu:chrony-per-server-config
Draft

chrony: render per-server time source configuration#1030
xiaotianlyu wants to merge 1 commit into
bottlerocket-os:developfrom
xiaotianlyu:chrony-per-server-config

Conversation

@xiaotianlyu

@xiaotianlyu xiaotianlyu commented Sep 2, 2026

Copy link
Copy Markdown

Description of changes:

Updates the chrony configuration template to support both forms of settings.ntp.time-servers.

The existing list form remains supported:

[settings.ntp]
time-servers = ["169.254.169.123", "time.aws.com"]
options = ["iburst"]

Each entry is rendered as a pool line with the shared options.

The new named form can configure each time source separately:

[settings.ntp.time-servers.link-local]
address = "169.254.169.123"
directive = "server"
options = ["prefer", "iburst", "minpoll 4", "maxpoll 4"]

This is rendered as:

server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4

This PR also:

  • renders settings.ntp.logging as chrony log categories;
  • creates /var/log/chrony for those logs;
  • labels the directory for SELinux so chronyd can write to it.

The named settings model is added by the related settings-sdk PR. bottlerocket-os/bottlerocket-settings-sdk#146

Testing done:

Unit test:

cd sources && cargo test -p schnauzer --test chrony_conf_render

4 tests passed, covering:

  • the existing list form with shared options;
  • named servers with individual directives and options;
  • missing optional fields and default directive behavior;
  • entries with no address.

On-box testing with the complete three-PR change:

  • built a local core-kit and an aws-k8s-1.32 x86_64 AMI;
  • upgraded a Bottlerocket node from 1.64.0 to the test 1.65.0 image;
  • verified /etc/chrony.conf contained the expected server and pool lines;
  • verified chronyd was active with no restarts;
  • verified measurements.log, statistics.log, and tracking.log were written under /var/log/chrony with the expected owner and measure_t SELinux label;
  • rolled the node back to 1.64.0 successfully.

Related PRs:

This PR depends on a settings-sdk release containing PR #146. The Bottlerocket PR depends on a core-kit release containing this change.

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.

Render time-servers as either the legacy URL list or a named map with
per-server directives and options. Select the format with the is_array
helper and render logging from the ntp.logging setting.

Create and label /var/log/chrony for chronyd output. Add schnauzer
render tests for both time-server formats and optional fields.

Signed-off-by: Melody Lyu <tianlyu@amazon.com>
@xiaotianlyu
xiaotianlyu force-pushed the chrony-per-server-config branch from 8f01b47 to e6e941f Compare September 2, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant