Merge pull request #4048 from siliconsheep/fix-google-srv-records

fix(google): ensure trailing dot for SRV records
This commit is contained in:
Kubernetes Prow Robot 2023-11-15 13:12:45 +01:00 committed by GitHub
commit fc87eaff72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -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() {

View File

@ -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) {