mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-05 17:16:59 +02:00
fix(google): ensure trailing dot for SRV records
This commit is contained in:
parent
438d06f3c4
commit
6a3e97083c
@ -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
|
||||
var ttl int64 = googleRecordTTL
|
||||
if ep.RecordTTL.IsConfigured() {
|
||||
|
@ -383,6 +383,27 @@ func testCRDSourceEndpoints(t *testing.T) {
|
||||
expectEndpoints: true,
|
||||
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
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user