Skip to content

feat: zone_groups support and ZoneResolver service - #61

Merged
cl8dep merged 6 commits into
mainfrom
feat/zone-groups
Apr 29, 2026
Merged

feat: zone_groups support and ZoneResolver service#61
cl8dep merged 6 commits into
mainfrom
feat/zone-groups

Conversation

@cl8dep

@cl8dep cl8dep commented Apr 29, 2026

Copy link
Copy Markdown
Owner

Fixes #60

Summary

  • Adds zone_groups: config section for auto-discovery of zones from a provider without listing each one explicitly
  • Introduces IZoneResolver service that merges explicit zones: + discovered zone_groups: — decoupling zone loading from command logic
  • Explicit zones: always wins over zone_groups: (warning shown on conflict)
  • Optional include_pattern / exclude_pattern regex filters per group
  • All 4 commands (plan, apply, drift, validate) now use IZoneResolver
  • Config validation updated for zone_groups
  • Config summary now shows zone group count when > 0

New config structure

zone_groups:
  all-prd:
    source: yaml_prd
    targets:
      - cf_prd
    include_pattern: ".*\\.com\\."   # optional
    exclude_pattern: "staging\\..*"  # optional

Test plan

  • Config with only zones: → behavior identical to current (no regression)
  • Config with zone_groups: → discovered zones are planned/applied/drifted
  • Zone in both zones: and zone_groups: → explicit wins, warning shown
  • include_pattern / exclude_pattern filter correctly
  • dns-sync validate validates zone_groups zones
  • dns-sync drift checks zone_groups zones
  • dotnet test → all 188 tests pass

Introduces zone_groups as a way to auto-discover zones from a provider
without listing each one explicitly. Explicit zones: entries always take
precedence over zone_groups (with a warning on conflict). All four commands
(plan, apply, drift, validate) now use IZoneResolver for zone loading.
@cl8dep cl8dep added this to the v0.6.0 — GitOps Complete milestone Apr 29, 2026
@cl8dep cl8dep added the enhancement New feature or request label Apr 29, 2026
cl8dep added 5 commits April 29, 2026 13:12
… coverage

Adds ~100 new tests across 5 new files and 1 expanded file:

- ZoneResolverTests: 20 tests covering discovery, include/exclude patterns,
  explicit-zone precedence, case insensitivity, multiple groups, failure resilience
- ZoneDiffEdgeCaseTests: 14 tests for empty zones, wildcards, SOA filtering,
  apex-NS flags, TTL-only changes, mixed create/update/delete
- ZoneValidatorBoundaryTests: 18 tests for TTL=0/max, SRV port 0/65535/65536,
  MX preference 0/65535/65536, CAA flags, empty zones
- ZoneYamlSerializerEdgeCaseTests: 15 tests for QuoteScalar (@, backtick, colon,
  hash, quotes, backslash, empty) and QuoteTxt round-trips
- YamlProviderEdgeCaseTests: 15 tests for paths with spaces, hyphens, missing
  files, non-YAML files, malformed YAML, TTL defaults, \; unescape, key edge cases
- ConfigLoaderTests: +8 zone_groups validation tests (parsing, unknown source/target,
  same source+target, read-only target, empty targets, zone_groups-only config)
DNS names are case-insensitive per RFC 1035. GroupBy now uses
ToLowerInvariant() on name and ToUpperInvariant() on type so that
records differing only in case are treated as the same RRset.

Discovered during test audit — previously ZoneDiff was case-sensitive,
which could cause spurious creates/deletes if providers returned names
in different cases.
@cl8dep
cl8dep merged commit a7cae22 into main Apr 29, 2026
1 check passed
@cl8dep
cl8dep deleted the feat/zone-groups branch April 29, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: zone_groups support for auto-discovery of zones from a provider

1 participant