Skip to content
Open
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
8 changes: 8 additions & 0 deletions source/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ func (cs *crdSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error
continue // no format constraint on targets
case endpoint.RecordTypeCNAME:
continue // RFC 1035 §5.1: trailing dot denotes an absolute FQDN in zone file notation; both forms are valid
case endpoint.RecordTypeSRV:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is required. Have you actually tried to create an SRV record? It was tested there #6023 (comment)

// SRV targets are "<prio> <weight> <port> <host>"; RFC 2782
// requires the host to be an absolute FQDN and
// Endpoint.ValidateSRVRecord enforces the trailing dot.
// Reject-on-trailing-dot (the default branch below) would
// loop users between this warning and ValidateSRVRecord's
// "does not end with a dot" error (#6357).
continue
}

hasDot := strings.HasSuffix(target, ".")
Expand Down
28 changes: 28 additions & 0 deletions source/crd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,22 @@ func testCRDSourceEndpoints(t *testing.T) {
},
expectEndpoints: true,
},
{
title: "SRV target with trailing dot (RFC 2782 absolute FQDN host) is valid (#6357)",
namespaceFilter: "foo",
objectNamespace: "foo",
labels: map[string]string{"test": "that"},
labelSelector: labels.SelectorFromSet(labels.Set{"test": "that"}),
endpoints: []*endpoint.Endpoint{
{
DNSName: "_svc._tcp.example.org",
Targets: endpoint.Targets{"0 0 80 abc.example.org.", "10 20 443 def.example.org."},
RecordType: endpoint.RecordTypeSRV,
RecordTTL: 180,
},
},
expectEndpoints: true,
},
{
title: "Create NAPTR record",
namespaceFilter: "foo",
Expand Down Expand Up @@ -549,6 +565,18 @@ func TestCRDSourceIllegalTargetWarnings(t *testing.T) {
},
wantWarning: ``,
},
{
title: "SRV target with trailing dot produces no warning (#6357)",
endpoints: []*endpoint.Endpoint{
{
DNSName: "_svc._tcp.example.org",
Targets: endpoint.Targets{"0 0 80 abc.example.org."},
RecordType: endpoint.RecordTypeSRV,
RecordTTL: 180,
},
},
wantWarning: ``,
},
} {
t.Run(ti.title, func(t *testing.T) {
hook := logtest.LogsUnderTestWithLogLevel(log.WarnLevel, t)
Expand Down