Skip to content

feat: support localdns hosts plugin refresh override#8895

Open
saewoni wants to merge 1 commit into
mainfrom
sakwa/localdns-hosts-plugin-refresh-interval
Open

feat: support localdns hosts plugin refresh override#8895
saewoni wants to merge 1 commit into
mainfrom
sakwa/localdns-hosts-plugin-refresh-interval

Conversation

@saewoni

@saewoni saewoni commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

This change lets AgentBaker carry a LocalDNS hosts plugin refresh interval from node bootstrapping config down to provisioning, instead of relying on the hardcoded 15 minute timer cadence.

It adds the new LocalDNS field to the datamodel and aks-node-controller proto/parser paths, emits the value into both legacy CSE and scriptless env, and updates cse_config.sh to rewrite aks-localdns-hosts-setup.timer when a positive interval is provided. When the field is unset or invalid, provisioning keeps the existing default behavior.

This complements the corresponding AKS-RP change in PR 16401188.

Validation run:

  • make validate-shell
  • docker run --rm -v /home/sakwa/AgentBaker:/workspace -w /workspace shellspec-docker --shell bash --format d spec/parts/linux/cloud-init/artifacts/cse_config_spec.sh
  • go test ./pkg/agent/...
  • cd aks-node-controller && go test ./parser
  • ./hack/tools/bin/golangci-lint run ./pkg/agent/...
  • cd aks-node-controller && ../hack/tools/bin/golangci-lint run ./parser/...

Which issue(s) this PR fixes:

Fixes #

@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 11, 2026, 6:53 AM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for configuring the AKS LocalDNS hosts plugin refresh interval end-to-end (datamodel → template/provisioning env → CSE behavior), replacing reliance on the fixed 15-minute systemd timer cadence when an explicit positive interval is provided.

Changes:

  • Extend the AgentBaker datamodel and template func map to carry hostsPluginRefreshIntervalInSeconds into provisioning.
  • Extend aks-node-controller proto + parser to emit LOCALDNS_HOSTS_PLUGIN_REFRESH_INTERVAL_IN_SECONDS for scriptless provisioning.
  • Update Linux CSE (cse_config.sh) to rewrite aks-localdns-hosts-setup.timer OnUnitActiveSec when a valid positive interval is provided, with new/updated tests.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
spec/parts/linux/cloud-init/artifacts/cse_config_spec.sh Adds ShellSpec coverage for timer interval override behavior.
pkg/agent/datamodel/types.go Adds HostsPluginRefreshIntervalInSeconds to LocalDNSProfile JSON schema.
pkg/agent/baker.go Adds template function to render refresh interval into CSE templates.
pkg/agent/baker_test.go Unit tests for the new template function behavior (nil/invalid/valid).
parts/linux/cloud-init/artifacts/cse_config.sh Applies the provided interval by editing the systemd timer before enabling it.
parts/linux/cloud-init/artifacts/cse_cmd.sh Emits the new refresh interval env var for legacy CSE flow.
aks-node-controller/proto/aksnodeconfig/v1/localdns_config.proto Adds optional refresh interval field to LocalDNS proto.
aks-node-controller/pkg/gen/aksnodeconfig/v1/localdns_config.pb.go Regenerates protobuf bindings for the new field.
aks-node-controller/parser/parser.go Exposes the new interval as a CSE env var in scriptless mode.
aks-node-controller/parser/parser_test.go Validates env var emission in integration-style parser tests.
aks-node-controller/parser/helper.go Adds helper to stringify/validate refresh interval from proto config.
aks-node-controller/parser/helper_test.go Unit tests for the new helper’s nil/invalid/valid cases.
Files not reviewed (1)
  • aks-node-controller/pkg/gen/aksnodeconfig/v1/localdns_config.pb.go: Generated file

Copilot AI review requested due to automatic review settings July 11, 2026 06:53
@saewoni saewoni force-pushed the sakwa/localdns-hosts-plugin-refresh-interval branch from 38e6e82 to d03db7d Compare July 11, 2026 06:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • aks-node-controller/pkg/gen/aksnodeconfig/v1/localdns_config.pb.go: Generated file

;;
*)
if [ "${hosts_plugin_refresh_interval}" -gt 0 ]; then
sed -i "s/^OnUnitActiveSec=.*/OnUnitActiveSec=${hosts_plugin_refresh_interval}s/" "${hosts_setup_timer}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems very hacky. I would think that there would be some form of timer.template and then you render it either on agentbaker side or aks-node-controller side?

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.

3 participants