Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(google): ensure trailing dot for SRV records #4048

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions provider/google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
21 changes: 21 additions & 0 deletions source/crd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading