Commit graph

95 commits

Author SHA1 Message Date
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
Tom Limoncelli
bfc2b26911
CHORE: generate-all.sh (#3827) 2025-11-03 15:32:53 -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
b947bddf95
CHORE: generate-all.sh (#3699) 2025-07-30 20:49:54 -04:00
Tom Limoncelli
b0a57e5c3e
DOCS: Improve docs and error messages related to apex domains (#3690) 2025-07-30 20:43:42 -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
Yuhui Xu
113c1ac13b
GCORE: Implement ListZones to allow auto create zones (#3588) 2025-05-29 09:56:33 -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
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
Tom Limoncelli
5ad2df1076
BUG: fix panic message (#3489) 2025-03-10 19:39:20 -04:00
Tom Limoncelli
f281698124
CHORE: Update dependencies (#3484) 2025-03-07 10:45:51 -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
Tom Limoncelli
8c3903ea8c
CHORE: update deps; go generate (#3455) 2025-02-24 07:03:27 -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
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
Tom Limoncelli
74826d3430
update deps; go generate (#3106) 2024-09-03 14:25:34 -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
Tom Limoncelli
fe7370b9a6
CHORE: go generate (#3079) 2024-08-13 10:57:31 -04:00
Tom Limoncelli
0869052419
CLOUDFLAREAPI: CF_SINGLE_REDIRECT improvements: fix bugs, log translated redirects (#3051) 2024-07-18 12:10:46 -04:00
Tom Limoncelli
cff63b5d75
BUGFIX: Remove debug statement left in by mistake (#3041) 2024-07-09 14:29:27 -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
Jeffrey Cafferata
f0d131986d
DOCS: Several improvements and cleanups (#2972)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2024-05-22 11:47:20 -04:00
Jeffrey Cafferata
1205ef6343
DOCS: Code examples with END constant (#2950) 2024-05-13 08:47:23 -04:00
Tom Limoncelli
7741ef08f9
Enable support for SVCB/HTTPS in GCLOUD and HEDNS (#2926) 2024-05-01 18:20:59 -04:00
xtex
3f05482e6b
NEW RECORD TYPE: DNSKEY (#2917)
Signed-off-by: xtex <xtexchooser@duck.com>
2024-04-22 09:54:12 -04:00
Jeffrey Cafferata
5078927e01
DOCS: Simplified the provider URLs (providers) (#2914) 2024-04-18 09:43:50 -04:00
Jauder Ho
2f9d2487f6
Fix typo: "cooordinate" (#2910) 2024-04-15 08:36:03 -04:00
Jeffrey Cafferata
c31064781f
DOCS: Documentation directory structure (#2905) 2024-04-09 14:26:45 -04:00
Tom Limoncelli
1d96981e11
NEW FEATURE: Add RFC4183 support to REV() (#2879)
Co-authored-by: Thomas Misilo <tmisilo@ksu.edu>
Co-authored-by: Jeffrey Cafferata <jeffrey@jcid.nl>
2024-04-03 16:01:55 -04:00