plugin/kubernetes: fix metadata (#3642)

Automatically submitted.
This commit is contained in:
Chris O'Haver
2020-01-31 14:35:22 -05:00
committed by GitHub
parent f77c6e55bf
commit c9d567ab44
5 changed files with 9 additions and 9 deletions

View File

@@ -3,14 +3,16 @@ package kubernetes
import (
"context"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/metadata"
"github.com/coredns/coredns/request"
)
// Metadata implements the metadata.Provider interface.
func (k *Kubernetes) Metadata(ctx context.Context, state request.Request) context.Context {
zone := plugin.Zones(k.Zones).Matches(state.Name())
// possible optimization: cache r so it doesn't need to be calculated again in ServeDNS
r, err := parseRequest(state)
r, err := parseRequest(state.Name(), zone)
if err != nil {
metadata.SetValueFunc(ctx, "kubernetes/parse-error", func() string {
return err.Error()