mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2026-05-04 22:26:11 +02:00
Add trailing dot to NS records in Google Cloud DNS
NS records added in Google Cloud DNS must have a trailing dot. Otherwise the API throws the following error:
```
time="2024-11-04T10:34:20Z" level=error msg="googleapi: Error 400: Invalid value for 'entity.change.additions[cloud.k8gb.io.][NS].rrdata[0]': 'gslb-ns-eu-cloud.k8gb.io', invalid"
```
This is similar to CNAME, MX and SRV records.
---
This change was tested with the a DNSEndpoint CRD containing the following endpoints:
```
endpoints:
- dnsName: cloud.k8gb.io
recordTTL: 5
recordType: NS
targets:
- gslb-ns-eu-cloud.k8gb.io
- gslb-ns-us-cloud.k8gb.io
- dnsName: gslb-ns-eu-cloud.k8gb.io
```
And the record was successfully created
```
gcloud dns record-sets list --zone="k8gb" --type=NS --name "cloud.k8gb.io."
NAME TYPE TTL DATA
cloud.k8gb.io. NS 5 gslb-ns-eu-cloud.k8gb.io.,gslb-ns-us-cloud.k8gb.io.
```
Signed-off-by: Andre Aguas <andre.aguas@protonmail.com>
This commit is contained in:
parent
b2ec5228ec
commit
1fc97ec54a
@ -445,6 +445,12 @@ func newRecord(ep *endpoint.Endpoint) *dns.ResourceRecordSet {
|
||||
}
|
||||
}
|
||||
|
||||
if ep.RecordType == endpoint.RecordTypeNS {
|
||||
for i, nsRecord := range ep.Targets {
|
||||
targets[i] = provider.EnsureTrailingDot(nsRecord)
|
||||
}
|
||||
}
|
||||
|
||||
// no annotation results in a Ttl of 0, default to 300 for backwards-compatibility
|
||||
var ttl int64 = googleRecordTTL
|
||||
if ep.RecordTTL.IsConfigured() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user