plugin: use Zones.Contains when any match suffices (#8505)

This commit is contained in:
Ilya Kulakov
2026-09-02 23:59:58 -07:00
committed by GitHub
parent f1d835aa51
commit c942ca7c36
16 changed files with 25 additions and 30 deletions

View File

@@ -718,8 +718,7 @@ func (k *Kubernetes) Serial(state request.Request) uint32 {
func (k *Kubernetes) MinTTL(_state request.Request) uint32 { return k.ttl }
func (k *Kubernetes) isMultiClusterZone(zone string) bool {
z := plugin.Zones(k.opts.multiclusterZones).Matches(zone)
return z != ""
return plugin.Zones(k.opts.multiclusterZones).Contains(zone)
}
// match checks if a and b are equal.

View File

@@ -31,10 +31,7 @@ func (k *Kubernetes) Metadata(ctx context.Context, state request.Request) contex
if zone == "" {
return ctx
}
multicluster := false
if z := plugin.Zones(k.opts.multiclusterZones).Matches(state.Zone); z != "" {
multicluster = true
}
multicluster := plugin.Zones(k.opts.multiclusterZones).Contains(state.Zone)
// possible optimization: cache r so it doesn't need to be calculated again in ServeDNS
r, err := parseRequest(state.Name(), zone, multicluster, k.opts.zonal)
if err != nil {

View File

@@ -18,8 +18,7 @@ import (
// Transfer implements the transfer.Transfer interface.
func (k *Kubernetes) Transfer(zone string, serial uint32) (<-chan []dns.RR, error) {
match := plugin.Zones(k.Zones).Matches(zone)
if match == "" {
if !plugin.Zones(k.Zones).Contains(zone) {
return nil, transfer.ErrNotAuthoritative
}
// state is not used here, hence the empty request.Request{]