feat(dns): migrate DNS writes from resolvectl to persistent Netplan#348
Merged
feat(dns): migrate DNS writes from resolvectl to persistent Netplan#348
Conversation
Add a reusable netplan package with write-validate-apply flow, rollback on validation failure, and file-state KV tracking. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add avfs.VFS, jetstream.KeyValue, and hostname fields to the DNS Debian provider struct and constructor. These dependencies are needed for upcoming Netplan DNS write support. Move file provider creation earlier in agent_setup.go so fileStateKV and hostname are available when the DNS provider is constructed. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace the DNS write path (UpdateResolvConfByInterface) from resolvectl commands to Netplan YAML generation. The read path still uses resolvectl for querying current DNS state. Writes now generate /etc/netplan/osapi-dns.yaml and apply via the shared netplan.ApplyConfig helper with SHA-based idempotency. Co-Authored-By: Claude <noreply@anthropic.com>
Add export bridge and public test suite for generateDNSNetplanYAML, dnsNetplanPath, and resolvePrimaryInterface covering servers-only, search-domains-only, combined, IPv6, and facts-based interface resolution scenarios. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
DNS write operations now generate /etc/netplan/osapi-dns.yaml, validate with netplan generate, and apply with netplan apply. Reads stay on resolvectl. Shared netplan.ApplyConfig helper established for interface and route management to reuse. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Expand the supported contexts section to explain that fact resolution is universal — any string in any request gets resolved agent-side. Add array and broadcast examples. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #348 +/- ##
=======================================
Coverage 99.91% 99.91%
=======================================
Files 441 443 +2
Lines 21510 21606 +96
=======================================
+ Hits 21491 21587 +96
Misses 11 11
Partials 8 8
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/etc/netplan/osapi-dns.yamlinstead of runtimeresolvectlcommands — changes persist across rebootsnetplan.ApplyConfighelper handles the write → validate → apply flow with automatic rollback onnetplan generatefailureresolvectl(shows current runtime state)/etc/resolv.confdirectly)PUT /network/dns) — no SDK or CLI changes neededNetplan write flow
/etc/netplan/osapi-dns.yamlnetplan generate— validates merged confignetplan apply— applies validated configEstablishes pattern for
Both will reuse
netplan.ApplyConfigand the same file-per-concern pattern.Test plan
🤖 Generated with Claude Code