Commit graph

57 commits

Author SHA1 Message Date
Thomas Limoncelli
26b1913961
fixup 2025-12-04 11:37:42 -05:00
tridion
f1b30a1a04
feat: Add IGNORE_EXTERNAL_DNS() for Kubernetes external-dns coexistence (#3869)s
## Summary

This PR adds a new domain modifier `IGNORE_EXTERNAL_DNS()` that
automatically detects and ignores DNS records managed by Kubernetes
[external-dns](https://github.com/kubernetes-sigs/external-dns)
controller.

**Related Issue:** This addresses the feature request discussed in
StackExchange/dnscontrol#935 (Idea: Ownership system), where
@tlimoncelli indicated openness to accepting a PR for this
functionality.

## Problem

When running DNSControl alongside Kubernetes external-dns, users face a
challenge:

- **external-dns** dynamically creates DNS records based on Kubernetes
Ingress/Service resources
- Users cannot use `IGNORE()` because they cannot predict which record
names external-dns will create
- Using `NO_PURGE()` is too broad - it prevents DNSControl from cleaning
up any orphaned records

The fundamental issue is that `IGNORE()` requires static patterns known
at config-time, but external-dns creates records dynamically at runtime.

## Solution

`IGNORE_EXTERNAL_DNS()` solves this by detecting external-dns managed
records at runtime:

```javascript
D("example.com", REG_CHANGEME, DnsProvider(DSP_MY_PROVIDER),
    IGNORE_EXTERNAL_DNS(),  // Automatically ignore external-dns managed records
    A("@", "1.2.3.4"),
    CNAME("www", "@")
);
```

### How It Works

external-dns uses a TXT record registry to track ownership. For each
managed record, it creates a TXT record like:

- `a-myapp.example.com` → TXT containing
`heritage=external-dns,external-dns/owner=...`
- `cname-api.example.com` → TXT containing
`heritage=external-dns,external-dns/owner=...`

This PR:
1. Scans existing TXT records for the `heritage=external-dns` marker
2. Parses the TXT record name prefix (e.g., `a-`, `cname-`) to determine
the managed record type
3. Automatically adds those records to the ignore list during diff
operations

## Changes

| File | Purpose |
|------|---------|
| `models/domain.go` | Add `IgnoreExternalDNS` field to DomainConfig |
| `pkg/js/helpers.js` | Add `IGNORE_EXTERNAL_DNS()` JavaScript helper |
| `pkg/diff2/externaldns.go` | Core detection logic for external-dns TXT
records |
| `pkg/diff2/externaldns_test.go` | Unit tests for detection logic |
| `pkg/diff2/handsoff.go` | Integrate external-dns detection into
handsoff() |
| `pkg/diff2/diff2.go` | Pass IgnoreExternalDNS flag to handsoff() |
| `commands/types/dnscontrol.d.ts` | TypeScript definitions for IDE
support |
| `documentation/.../IGNORE_EXTERNAL_DNS.md` | User documentation |

## Design Philosophy

This follows DNSControl's pattern of convenience builders (like
`M365_BUILDER`, `SPF_BUILDER`, `DKIM_BUILDER`) that make complex
operations simple. Just as those builders abstract away implementation
details, `IGNORE_EXTERNAL_DNS()` abstracts away the complexity of
detecting external-dns managed records.

## Testing

All unit tests pass:
```
go test ./pkg/diff2/... -v  # Tests detection logic
go test ./pkg/js/...        # Tests JS helpers
go build ./...              # Builds successfully
```

## Caveats Documented

- Only supports TXT registry (the default for external-dns)
- Requires external-dns to use default naming conventions
- May need updates if external-dns changes its registry format

---------

Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-12-03 08:56:55 -05:00
Gabe Van Engel
97209bc2fc
AKAMAIEDGEDNS: Add ALIAS and AKAMAITLC support to the Akamai Edge DNS provider (#3836) 2025-11-14 09:48:42 -05:00
Matteo Trubini
d8aa89028e
refactor(DKIM_BUILDER): improve input validation and error handling (#3812) 2025-11-03 11:33:09 -05:00
Elvis Ratzlaff
2a4e2509bc
POWERDNS: New record type: LUA (#3815) 2025-11-03 11:32:28 -05:00
Jan von Aschwege
a71b89e5a2
NEW FEATURE: Add SMIMEA support for BIND and deSEC (#3786) 2025-10-10 11:16:13 -04:00
Paul Sütterlin
589cb77c68
CAA: Support issuemail / issuevmc tag in CAA builder (#3774)
Co-authored-by: Paul Sütterlin <psuet@kawo1.rwth-aachen.de>
2025-09-22 16:12:30 -04:00
Tom Limoncelli
f2ff95a20e
FEATURE: Optionally disable spfcache.json (#3765)
Co-authored-by: Jeffrey Cafferata <jeffrey@jcid.nl>
2025-09-13 12:23:46 -04:00
Eli Heady
8b73de0765
DOCS: Fix many minor typos (#3752)
Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-09-02 11:00:25 -04:00
Jeffrey Cafferata
60bbab6fa1
DOCS: Clarification on quotes in TXT record. (#3721) 2025-08-13 09:58:19 -04:00
Georg
8c8948e69a
NEW RECORD TYPE: OPENPGPKEY (basic) (#3718)
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-08-11 10:44:12 -04:00
Tom Limoncelli
b0a57e5c3e
DOCS: Improve docs and error messages related to apex domains (#3690) 2025-07-30 20:43:42 -04:00
Jeffrey Cafferata
088ea41ee1
DOCS: Getting started get-zones (feedback) (#3700) 2025-07-30 20:43:12 -04:00
Tom Limoncelli
1f86d69b09
DOCS: Warn that "" should be "@" in error messages & docs. Update docs to suggest safer onboarding process. (#3691) 2025-07-29 14:50:59 -04:00
Costas Drogos
c842eb26a5
NEW FEATURE: DKIM_BUILDER() adds a DKIM record builder (#3627)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-07-18 10:38:50 -04:00
Ishan Jain
e1830abb58
NEW PROVIDER: ADGUARDHOME (#3638) 2025-07-09 12:06:34 -04:00
Jeffrey Cafferata
e5f4d97950
DOCS: [GitBook] Refactor structure to match URL paths and fix missing page links (#3613) 2025-06-11 16:20:23 -04:00
Max Chernoff
3ea7ea84c9
FEATURE: Support ignoring the ech= parameter in HTTPS/SVCB RR types (#3485) 2025-06-11 11:16:15 -04:00
Will Power
1d148f430b
DOCS: document redirect types (#3585) 2025-05-28 10:01:09 -04:00
Eli Heady
d0fffaf8c2
BUGFIX: types fix: CAA_BUILDER accepts string[] or string for issue (#3546) 2025-05-03 08:21:44 -04:00
Jeffrey Cafferata
bb7f881754
BUG: Fixed concurrency verified matrix builder (#3537) 2025-04-19 09:08:49 -04:00
gotjoshua
c4f5bdae0e
DOCS: add for CONCURRENCY_VERIFIED (#3510)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-04-03 13:01:26 -04:00
Tom Limoncelli
14c3acb801
feat(cloudflare) SINGLE_REDIRECT permits more than 301/302 redirects (#3514) 2025-03-30 16:16:12 -04:00
Max Chernoff
839d510b73
DOCS: Fix typo in IGNORE.md (#3512) 2025-03-30 14:25:08 -04:00
Lance A. Brown
7661175d58
META: typescript: Mark recursive parameter of require_glob optional (#3508) 2025-03-26 06:42:29 -04:00
Alfonso Montero López
1e5acba8e3
DOCS: language-reference/D: fix broken link (#3486) 2025-03-10 10:34:38 -04:00
Jan-Piet Mens
83a36a6745
DOCS: SOA RNAME description isn't accurate (#3481) 2025-03-07 09:06:23 -05:00
Eli Heady
48c99f7065
Improve tagged domain handling in support of Split Horizon feature (#3444)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-02-25 12:27:24 -05:00
Lance A. Brown
f3bdb1740a
DOCS: Fix quoting issue in D.md (#3446) 2025-02-21 07:32:01 -05:00
imlonghao
e0e32ca1a9
DOCS: fix broken links (#3437) 2025-02-17 08:41:37 -05:00
Costas Drogos
4f5655e510
NS1: remove deprecated NS1_URLFWD (#3400)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-01-27 10:29:26 -05:00
Jeffrey Cafferata
519e4f82e1
DOCS: Provider URI redirect (#3307)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-01-06 09:53:49 -05:00
Jeffrey Cafferata
ee4970471b
DOCS: Trailing commas are no longer an issue (#3248) 2024-12-17 07:46:37 -05:00
Tom Limoncelli
5c68ccb135
CHORE: update deps (#3197) 2024-11-07 18:24:32 -05:00
Tom Limoncelli
df8f8a6426
feat(import_transform): skip records with import_transform_skip set (#3193) 2024-11-07 17:21:35 -05:00
Tom Limoncelli
583cba3855
IMPORT_TRANSFORM_SUFFIX: Fix for CNAMEs (#3192) 2024-11-04 17:00:08 -05:00
Tom Limoncelli
1872b12116
NEW FEATURE: IMPORT_TRANSFORM_STRIP (#3181) 2024-10-31 11:05:56 -04:00
Paul Donald
d6d50fc862
LOC: fix float altitude value ingestion, gate size and precision values (#3130)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2024-09-27 12:06:19 -04:00
Tom Limoncelli
12a72cb729
DOCS: Minor clarifications on NAMESERVER() (#3113) 2024-09-16 20:21:59 -04:00
imlonghao
04f34cf2e3
PORKBUN: support URL Forward (#3064)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2024-08-26 14:50:25 -04:00
fuero
94a0cfcba3
New Feature: HASH() adds hashing functions to dnsconfig.js language (#3085)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2024-08-21 09:21:39 -04:00
Costas Drogos
2b1aa5fb6d
DOCS: add docs for NS1_URLFWD (#3075)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2024-08-13 09:43:23 -04:00
Tom Limoncelli
0869052419
CLOUDFLAREAPI: CF_SINGLE_REDIRECT improvements: fix bugs, log translated redirects (#3051) 2024-07-18 12:10:46 -04:00
Nikola Milekic
1d348de91c
DOCS: Fix M365_BUILDER examples (#3009)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2024-07-18 11:16:03 -04:00
Jeffrey Cafferata
7b286091d5
DOCS: CLOUDFLAREAPI - CF_SINGLE_REDIRECT (#3038) 2024-07-08 16:35:35 -04:00
Tom Limoncelli
088306883d
CLOUDFLAREAPI: Add CF_SINGLE_REDIRECT to manage "dynamic single" redirects (#3035) 2024-07-08 12:38:38 -04:00
Tom Limoncelli
8eb3c65050
FEATURE: Enable "require()" function to accept json5 files (#3003)
Co-authored-by: charliez0 <charliez0sp@gmail.com>
2024-06-11 15:27:11 -04:00
Jeffrey Cafferata
39c08bd0bd
DOCS: Provide domain modifiers code examples with a Top Level Function D() (#2993) 2024-06-05 14:45:43 -04:00
Jeffrey Cafferata
9dcd8c793a
DOCS: AUTODNSSEC_* improvements (#2984) 2024-06-03 14:31:47 -04:00
Jeffrey Cafferata
1f4c4c65f5
FEATURE: Add TTL() support to CAA_BUILDER() (#2978) 2024-05-29 16:36:26 -04:00