mirror of
https://github.com/coredns/coredns.git
synced 2026-10-08 19:45:21 -04:00
plugin: use Zones.Contains when any match suffices (#8505)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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{]
|
||||
|
||||
Reference in New Issue
Block a user