diff --git a/controller/controller.go b/controller/controller.go index 4353fe44f..4eb7c9fb7 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -151,7 +151,7 @@ func (c *Controller) RunOnce(ctx context.Context) error { Desired: endpoints, DomainFilter: c.DomainFilter, PropertyComparator: c.Registry.PropertyValuesEqual, - ManagedRecords: []string{endpoint.RecordTypeA, endpoint.RecordTypeCNAME}, + ManagedRecords: c.ManagedRecordTypes, } plan = plan.Calculate() diff --git a/controller/controller_test.go b/controller/controller_test.go index 8c042d085..a2012c7d7 100644 --- a/controller/controller_test.go +++ b/controller/controller_test.go @@ -25,6 +25,7 @@ import ( "sigs.k8s.io/external-dns/endpoint" "sigs.k8s.io/external-dns/internal/testutils" + "sigs.k8s.io/external-dns/pkg/apis/externaldns" "sigs.k8s.io/external-dns/plan" "sigs.k8s.io/external-dns/provider" "sigs.k8s.io/external-dns/registry" @@ -95,6 +96,8 @@ func newMockProvider(endpoints []*endpoint.Endpoint, changes *plan.Changes) prov func TestRunOnce(t *testing.T) { // Fake some desired endpoints coming from our source. source := new(testutils.MockSource) + cfg := externaldns.NewConfig() + cfg.ManagedDNSRecordTypes = []string{endpoint.RecordTypeA, endpoint.RecordTypeCNAME} source.On("Endpoints").Return([]*endpoint.Endpoint{ { DNSName: "create-record", @@ -143,9 +146,10 @@ func TestRunOnce(t *testing.T) { // Run our controller once to trigger the validation. ctrl := &Controller{ - Source: source, - Registry: r, - Policy: &plan.SyncPolicy{}, + Source: source, + Registry: r, + Policy: &plan.SyncPolicy{}, + ManagedRecordTypes: cfg.ManagedDNSRecordTypes, } assert.NoError(t, ctrl.RunOnce(context.Background()))