mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-07 01:56:57 +02:00
NS record support
This commit is contained in:
parent
45471b7372
commit
904d8e4c87
2
.gitignore
vendored
2
.gitignore
vendored
@ -46,3 +46,5 @@ external-dns
|
|||||||
|
|
||||||
# vendor dir
|
# vendor dir
|
||||||
vendor/
|
vendor/
|
||||||
|
|
||||||
|
profile.cov
|
||||||
|
@ -33,6 +33,8 @@ const (
|
|||||||
RecordTypeTXT = "TXT"
|
RecordTypeTXT = "TXT"
|
||||||
// RecordTypeSRV is a RecordType enum value
|
// RecordTypeSRV is a RecordType enum value
|
||||||
RecordTypeSRV = "SRV"
|
RecordTypeSRV = "SRV"
|
||||||
|
// RecordTypeNS is a RecordType enum value
|
||||||
|
RecordTypeNS = "NS"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TTL is a structure defining the TTL of a DNS record
|
// TTL is a structure defining the TTL of a DNS record
|
||||||
|
2
go.sum
2
go.sum
@ -15,6 +15,8 @@ code.cloudfoundry.org/gofileutils v0.0.0-20170111115228-4d0c80011a0f/go.mod h1:s
|
|||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
git.blindage.org/21h/hcloud-dns v0.0.0-20200525170043-def10a4a28e0 h1:kdxglEveTcqIG5zEPdQ0Y5KctnIGR7zXsQCQakoTNxU=
|
git.blindage.org/21h/hcloud-dns v0.0.0-20200525170043-def10a4a28e0 h1:kdxglEveTcqIG5zEPdQ0Y5KctnIGR7zXsQCQakoTNxU=
|
||||||
git.blindage.org/21h/hcloud-dns v0.0.0-20200525170043-def10a4a28e0/go.mod h1:n26Twiii5jhkMC+Ocz/s8R73cBBcXRIwyTqQ+6bOZGo=
|
git.blindage.org/21h/hcloud-dns v0.0.0-20200525170043-def10a4a28e0/go.mod h1:n26Twiii5jhkMC+Ocz/s8R73cBBcXRIwyTqQ+6bOZGo=
|
||||||
|
git.blindage.org/21h/hcloud-dns v0.0.0-20200807003420-f768ffe03f8d h1:d6sdozgfqtgaOhjUn++lbo5siX3HELjcOUnbtrvVQi4=
|
||||||
|
git.blindage.org/21h/hcloud-dns v0.0.0-20200807003420-f768ffe03f8d/go.mod h1:n26Twiii5jhkMC+Ocz/s8R73cBBcXRIwyTqQ+6bOZGo=
|
||||||
github.com/Azure/azure-sdk-for-go v45.1.0+incompatible h1:kxtaPD8n2z5Za+9e3sKsYG2IX6PG2R6VXtgS7gAbh3A=
|
github.com/Azure/azure-sdk-for-go v45.1.0+incompatible h1:kxtaPD8n2z5Za+9e3sKsYG2IX6PG2R6VXtgS7gAbh3A=
|
||||||
github.com/Azure/azure-sdk-for-go v45.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
github.com/Azure/azure-sdk-for-go v45.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
|
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
|
||||||
|
@ -242,7 +242,7 @@ func filterRecordsForPlan(records []*endpoint.Endpoint, domainFilter endpoint.Do
|
|||||||
// Explicitly specify which records we want to use for planning.
|
// Explicitly specify which records we want to use for planning.
|
||||||
// TODO: Add AAAA records as well when they are supported.
|
// TODO: Add AAAA records as well when they are supported.
|
||||||
switch record.RecordType {
|
switch record.RecordType {
|
||||||
case endpoint.RecordTypeA, endpoint.RecordTypeCNAME:
|
case endpoint.RecordTypeA, endpoint.RecordTypeCNAME, endpoint.RecordTypeNS:
|
||||||
filtered = append(filtered, record)
|
filtered = append(filtered, record)
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
|
@ -17,10 +17,10 @@ limitations under the License.
|
|||||||
package provider
|
package provider
|
||||||
|
|
||||||
// SupportedRecordType returns true only for supported record types.
|
// SupportedRecordType returns true only for supported record types.
|
||||||
// Currently A, CNAME, SRV, and TXT record types are supported.
|
// Currently A, CNAME, SRV, TXT and NS record types are supported.
|
||||||
func SupportedRecordType(recordType string) bool {
|
func SupportedRecordType(recordType string) bool {
|
||||||
switch recordType {
|
switch recordType {
|
||||||
case "A", "CNAME", "SRV", "TXT":
|
case "A", "CNAME", "SRV", "TXT", "NS":
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
@ -351,6 +351,26 @@ func testCRDSourceEndpoints(t *testing.T) {
|
|||||||
expectEndpoints: true,
|
expectEndpoints: true,
|
||||||
expectError: false,
|
expectError: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Create NS 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: "abc.example.org",
|
||||||
|
Targets: endpoint.Targets{"ns1.k8s.io", "ns2.k8s.io"},
|
||||||
|
RecordType: endpoint.RecordTypeNS,
|
||||||
|
RecordTTL: 180,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expectEndpoints: true,
|
||||||
|
expectError: false,
|
||||||
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(ti.title, func(t *testing.T) {
|
t.Run(ti.title, func(t *testing.T) {
|
||||||
restClient := startCRDServerToServeTargets(ti.endpoints, ti.registeredAPIVersion, ti.registeredKind, ti.registeredNamespace, "test", ti.annotations, ti.labels, t)
|
restClient := startCRDServerToServeTargets(ti.endpoints, ti.registeredAPIVersion, ti.registeredKind, ti.registeredNamespace, "test", ti.annotations, ti.labels, t)
|
||||||
|
Loading…
Reference in New Issue
Block a user