diff --git a/controller/controller.go b/controller/controller.go index af3e3219a..369c05482 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -175,7 +175,7 @@ type Controller struct { // The interval between individual synchronizations Interval time.Duration // The DomainFilter defines which DNS records to keep or exclude - DomainFilter endpoint.DomainFilterInterface + DomainFilter endpoint.DomainFilter // The nextRunAt used for throttling and batching reconciliation nextRunAt time.Time // The nextRunAtMux is for atomic updating of nextRunAt diff --git a/controller/controller_test.go b/controller/controller_test.go index 9f37ab295..500b3bd41 100644 --- a/controller/controller_test.go +++ b/controller/controller_test.go @@ -47,7 +47,7 @@ type mockProvider struct { type filteredMockProvider struct { provider.BaseProvider - domainFilter endpoint.DomainFilterInterface + domainFilter endpoint.DomainFilter RecordsStore []*endpoint.Endpoint RecordsCallCount int ApplyChangesCalls []*plan.Changes @@ -57,7 +57,7 @@ type errorMockProvider struct { mockProvider } -func (p *filteredMockProvider) GetDomainFilter() endpoint.DomainFilterInterface { +func (p *filteredMockProvider) GetDomainFilter() endpoint.DomainFilter { return p.domainFilter } @@ -279,7 +279,7 @@ func TestShouldRunOnce(t *testing.T) { assert.True(t, ctrl.ShouldRunOnce(now)) } -func testControllerFiltersDomains(t *testing.T, configuredEndpoints []*endpoint.Endpoint, domainFilter endpoint.DomainFilterInterface, providerEndpoints []*endpoint.Endpoint, expectedChanges []*plan.Changes) { +func testControllerFiltersDomains(t *testing.T, configuredEndpoints []*endpoint.Endpoint, domainFilter endpoint.DomainFilter, providerEndpoints []*endpoint.Endpoint, expectedChanges []*plan.Changes) { t.Helper() cfg := externaldns.NewConfig() cfg.ManagedDNSRecordTypes = []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME} @@ -353,7 +353,7 @@ func TestWhenNoFilterControllerConsidersAllComain(t *testing.T) { Targets: endpoint.Targets{"8.8.8.8"}, }, }, - nil, + endpoint.DomainFilter{}, []*endpoint.Endpoint{ { DNSName: "some-record.used.tld", diff --git a/provider/aws/aws.go b/provider/aws/aws.go index be1997c7e..9dbe9db1d 100644 --- a/provider/aws/aws.go +++ b/provider/aws/aws.go @@ -517,11 +517,11 @@ func (p *AWSProvider) createUpdateChanges(newEndpoints, oldEndpoints []*endpoint } // GetDomainFilter generates a filter to exclude any domain that is not controlled by the provider -func (p *AWSProvider) GetDomainFilter() endpoint.DomainFilterInterface { +func (p *AWSProvider) GetDomainFilter() endpoint.DomainFilter { zones, err := p.Zones(context.Background()) if err != nil { log.Errorf("failed to list zones: %v", err) - return &endpoint.DomainFilter{} + return endpoint.DomainFilter{} } zoneNames := []string(nil) for _, z := range zones { diff --git a/provider/aws/aws_test.go b/provider/aws/aws_test.go index 4ed172d98..61bf62b45 100644 --- a/provider/aws/aws_test.go +++ b/provider/aws/aws_test.go @@ -319,7 +319,7 @@ func TestAWSRecordsFilter(t *testing.T) { assert.NotNil(t, domainFilter) require.IsType(t, endpoint.DomainFilter{}, domainFilter) count := 0 - filters := domainFilter.(endpoint.DomainFilter).Filters + filters := domainFilter.Filters for _, tld := range []string{ "zone-4.ext-dns-test-3.teapot.zalan.do", ".zone-4.ext-dns-test-3.teapot.zalan.do", diff --git a/provider/provider.go b/provider/provider.go index 3c8d358f1..73cd76dd9 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -38,7 +38,7 @@ type Provider interface { // unnecessary (potentially failing) changes. It may also modify other fields, add, or remove // Endpoints. It is permitted to modify the supplied endpoints. AdjustEndpoints(endpoints []*endpoint.Endpoint) []*endpoint.Endpoint - GetDomainFilter() endpoint.DomainFilterInterface + GetDomainFilter() endpoint.DomainFilter } type BaseProvider struct{} @@ -51,7 +51,7 @@ func (b BaseProvider) PropertyValuesEqual(name, previous, current string) bool { return previous == current } -func (b BaseProvider) GetDomainFilter() endpoint.DomainFilterInterface { +func (b BaseProvider) GetDomainFilter() endpoint.DomainFilter { return endpoint.DomainFilter{} } diff --git a/registry/aws_sd_registry.go b/registry/aws_sd_registry.go index 1ecd88546..49f153acf 100644 --- a/registry/aws_sd_registry.go +++ b/registry/aws_sd_registry.go @@ -42,7 +42,7 @@ func NewAWSSDRegistry(provider provider.Provider, ownerID string) (*AWSSDRegistr }, nil } -func (sdr *AWSSDRegistry) GetDomainFilter() endpoint.DomainFilterInterface { +func (sdr *AWSSDRegistry) GetDomainFilter() endpoint.DomainFilter { return sdr.provider.GetDomainFilter() } diff --git a/registry/noop.go b/registry/noop.go index 73257730c..8a034db19 100644 --- a/registry/noop.go +++ b/registry/noop.go @@ -36,7 +36,7 @@ func NewNoopRegistry(provider provider.Provider) (*NoopRegistry, error) { }, nil } -func (im *NoopRegistry) GetDomainFilter() endpoint.DomainFilterInterface { +func (im *NoopRegistry) GetDomainFilter() endpoint.DomainFilter { return im.provider.GetDomainFilter() } diff --git a/registry/registry.go b/registry/registry.go index fa39fb8ec..d99ba05f7 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -34,7 +34,7 @@ type Registry interface { ApplyChanges(ctx context.Context, changes *plan.Changes) error PropertyValuesEqual(attribute string, previous string, current string) bool AdjustEndpoints(endpoints []*endpoint.Endpoint) []*endpoint.Endpoint - GetDomainFilter() endpoint.DomainFilterInterface + GetDomainFilter() endpoint.DomainFilter } // TODO(ideahitme): consider moving this to Plan diff --git a/registry/txt.go b/registry/txt.go index e9411185b..6493ac9bd 100644 --- a/registry/txt.go +++ b/registry/txt.go @@ -96,7 +96,7 @@ func getSupportedTypes() []string { return []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME, endpoint.RecordTypeNS} } -func (im *TXTRegistry) GetDomainFilter() endpoint.DomainFilterInterface { +func (im *TXTRegistry) GetDomainFilter() endpoint.DomainFilter { return im.provider.GetDomainFilter() }