mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 09:36:58 +02:00
Merge pull request #4048 from siliconsheep/fix-google-srv-records
fix(google): ensure trailing dot for SRV records
This commit is contained in:
commit
fc87eaff72
@ -467,6 +467,12 @@ func newRecord(ep *endpoint.Endpoint) *dns.ResourceRecordSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ep.RecordType == endpoint.RecordTypeSRV {
|
||||||
|
for i, srvRecord := range ep.Targets {
|
||||||
|
targets[i] = provider.EnsureTrailingDot(srvRecord)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// no annotation results in a Ttl of 0, default to 300 for backwards-compatibility
|
// no annotation results in a Ttl of 0, default to 300 for backwards-compatibility
|
||||||
var ttl int64 = googleRecordTTL
|
var ttl int64 = googleRecordTTL
|
||||||
if ep.RecordTTL.IsConfigured() {
|
if ep.RecordTTL.IsConfigured() {
|
||||||
|
@ -383,6 +383,27 @@ func testCRDSourceEndpoints(t *testing.T) {
|
|||||||
expectEndpoints: true,
|
expectEndpoints: true,
|
||||||
expectError: false,
|
expectError: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Create SRV record",
|
||||||
|
registeredAPIVersion: "test.k8s.io/v1alpha1",
|
||||||
|
apiVersion: "test.k8s.io/v1alpha1",
|
||||||
|
registeredKind: "DNSEndpoint",
|
||||||
|
kind: "DNSEndpoint",
|
||||||
|
namespace: "foo",
|
||||||
|
registeredNamespace: "foo",
|
||||||
|
labels: map[string]string{"test": "that"},
|
||||||
|
labelFilter: "test=that",
|
||||||
|
endpoints: []*endpoint.Endpoint{
|
||||||
|
{
|
||||||
|
DNSName: "_svc._tcp.example.org",
|
||||||
|
Targets: endpoint.Targets{"0 0 80 abc.example.org", "0 0 80 def.example.org"},
|
||||||
|
RecordType: endpoint.RecordTypeSRV,
|
||||||
|
RecordTTL: 180,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expectEndpoints: true,
|
||||||
|
expectError: false,
|
||||||
|
},
|
||||||
} {
|
} {
|
||||||
ti := ti
|
ti := ti
|
||||||
t.Run(ti.title, func(t *testing.T) {
|
t.Run(ti.title, func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user