Skip to content

Support Cluster API NTP stanza - #12

Open
navaneeth-dev wants to merge 2 commits into
mainfrom
feat/ntp-cluster-api
Open

navaneeth-dev wants to merge 2 commits into
mainfrom
feat/ntp-cluster-api

Conversation

@navaneeth-dev

@navaneeth-dev navaneeth-dev commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Implement Cluster API’s ntp.enabled and ntp.servers using Flatcar’s native systemd-timesyncd, keeping DHCP-provided NTP sources allowed alongside configured servers. enabled: false leaves time synchronization untouched after validation; omitted/null/empty server lists retain Flatcar defaults.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@navaneeth-dev navaneeth-dev self-assigned this Oct 14, 2026
Configure Flatcar's native timesyncd while retaining DHCP-provided sources. Preserve native defaults for disabled NTP or empty server lists, and reject unsupported fields and unsafe server values.

Signed-off-by: Navaneeth <me@rizexor.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 17:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Navaneeth <me@rizexor.com>
Copilot AI balanced review requested due to automatic review settings October 17, 2026 05:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@navaneeth-dev
navaneeth-dev requested a review from elmiko October 17, 2026 05:42
@navaneeth-dev
navaneeth-dev marked this pull request as ready for review October 17, 2026 05:42
@navaneeth-dev
navaneeth-dev requested a review from a team as a code owner October 17, 2026 05:42

@elmiko elmiko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally looking good to me, i have a couple questions and a suggestion for the tests.

Comment thread ntp.go
// A hostname label is 1–63 ASCII letters, digits, or hyphens.
// The first and last characters must be letters or digits.
var ntpHostnameLabel = regexp.MustCompile(
`^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reference for the hostname label format?

if there is an RFC or some other doc that we could link to the in the comments, it would help with future triaging in case there is an error related to the regex or hostname.

Comment thread ntp_test.go
if err != nil {
t.Fatal(err)
}
explicit := strings.Replace(input, "ntp:\n", "ntp:\n enabled: true\n", 1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have a short comment here about why the input data needs to be changed.

Comment thread ntp_test.go
"ntp: {enabled: true, servers:}", "ntp: {enabled: true, servers: []}",
"ntp: {enabled: false, servers: [time.example.net]}",
} {
t.Run(stanza, func(t *testing.T) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using the full test stanza here, it's nice to use a descriptive name for each test case to make it easier when viewing test output later.

Comment thread ntp_test.go
{"ntp: {config: {}}", "ntp.config"},
}
for _, tt := range tests {
t.Run(tt.stanza, func(t *testing.T) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar here about using the stanza for the description.

Comment thread ntp_test.go
"ntp", "Time-1.example.net.", "xn--bcher-kva.example",
strings.Repeat("a", 63) + ".net", strings.Repeat("abc.", 63) + "a.",
} {
t.Run(server, func(t *testing.T) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well. having a readable name makes the debugging easier later.

Comment thread README.md
Comment on lines +108 to +110
`ntp: {}` retain Flatcar defaults without generating files or units.

This relies on Flatcar's native timesyncd service, does not switch clients on images

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm curious about the mention of flatcar here. does this mean that using this library with other linux versions (eg FedoraCoreOS) is going to be problematic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature A feature request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants