diff --git a/.gitignore b/.gitignore index 462d77a1d..30adb371d 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ external-dns # vendor dir vendor/ + +profile.cov diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go index cc3183d73..5f5ef1488 100644 --- a/endpoint/endpoint.go +++ b/endpoint/endpoint.go @@ -33,6 +33,8 @@ const ( RecordTypeTXT = "TXT" // RecordTypeSRV is a RecordType enum value RecordTypeSRV = "SRV" + // RecordTypeNS is a RecordType enum value + RecordTypeNS = "NS" ) // TTL is a structure defining the TTL of a DNS record diff --git a/go.sum b/go.sum index 9367c307b..4bbe8c060 100644 --- a/go.sum +++ b/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= 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-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/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= diff --git a/plan/plan.go b/plan/plan.go index 5c0aaf4c3..32040cb57 100644 --- a/plan/plan.go +++ b/plan/plan.go @@ -242,7 +242,7 @@ func filterRecordsForPlan(records []*endpoint.Endpoint, domainFilter endpoint.Do // Explicitly specify which records we want to use for planning. // TODO: Add AAAA records as well when they are supported. switch record.RecordType { - case endpoint.RecordTypeA, endpoint.RecordTypeCNAME: + case endpoint.RecordTypeA, endpoint.RecordTypeCNAME, endpoint.RecordTypeNS: filtered = append(filtered, record) default: continue diff --git a/provider/recordfilter.go b/provider/recordfilter.go index 487595a64..245d47570 100644 --- a/provider/recordfilter.go +++ b/provider/recordfilter.go @@ -17,10 +17,10 @@ limitations under the License. package provider // 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 { switch recordType { - case "A", "CNAME", "SRV", "TXT": + case "A", "CNAME", "SRV", "TXT", "NS": return true default: return false diff --git a/source/crd_test.go b/source/crd_test.go index c669b5080..919388a82 100644 --- a/source/crd_test.go +++ b/source/crd_test.go @@ -351,6 +351,26 @@ func testCRDSourceEndpoints(t *testing.T) { expectEndpoints: true, 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) { restClient := startCRDServerToServeTargets(ti.endpoints, ti.registeredAPIVersion, ti.registeredKind, ti.registeredNamespace, "test", ti.annotations, ti.labels, t)