Skip to content

Commit

Permalink
chore: move to external-dns's domain filter interface
Browse files Browse the repository at this point in the history
This had me confused for the last couple days. I don't understand why we don't give the actual DomainFilter here.
  • Loading branch information
kashalls committed Sep 7, 2024
1 parent e278b47 commit 0c10628
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions internal/unifi/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Provider struct {
domainFilter endpoint.DomainFilter
}

// newUnifiProvider initializes a new DNSProvider.
// NewUnifiProvider initializes a new DNSProvider.
func NewUnifiProvider(domainFilter endpoint.DomainFilter, config *Config) (provider.Provider, error) {
c, err := newUnifiClient(config)

Expand Down Expand Up @@ -77,6 +77,6 @@ func (p *Provider) ApplyChanges(ctx context.Context, changes *plan.Changes) erro
}

// GetDomainFilter returns the domain filter for the provider.
func (p *Provider) GetDomainFilter() endpoint.DomainFilter {
func (p *Provider) GetDomainFilter() endpoint.DomainFilterInterface {
return p.domainFilter
}
10 changes: 2 additions & 8 deletions pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,13 @@ func (p *Webhook) Negotiate(w http.ResponseWriter, r *http.Request) {
return
}

b, err := p.provider.GetDomainFilter().MarshalJSON()
w.Header().Set(contentTypeHeader, string(mediaTypeVersion1))
err := json.NewEncoder(w).Encode(p.provider.GetDomainFilter())
if err != nil {
requestLog(r).Error("failed to marshal domain filter")
w.WriteHeader(http.StatusInternalServerError)
return
}

w.Header().Set(contentTypeHeader, string(mediaTypeVersion1))
if _, writeError := w.Write(b); writeError != nil {
requestLog(r).With(zap.Error(writeError)).Error("error writing response")
w.WriteHeader(http.StatusInternalServerError)
return
}
}

func requestLog(r *http.Request) *zap.Logger {
Expand Down

0 comments on commit 0c10628

Please # to comment.