aboutsummaryrefslogtreecommitdiff
path: root/plugin/metadata/metadata.go
diff options
context:
space:
mode:
authorGravatar John Belamaric <jbelamaric@google.com> 2019-06-09 00:10:57 -0700
committerGravatar Miek Gieben <miek@miek.nl> 2019-06-09 08:10:57 +0100
commitffcd2f61cfc2290b23e92c9123cf71b854be9e0d (patch)
tree7870daa67eeb364e022b37d5489067ff65578b88 /plugin/metadata/metadata.go
parenta1c97f82a6f27ae1f4489a1dc5d0bc6fa4cce9ed (diff)
downloadcoredns-ffcd2f61cfc2290b23e92c9123cf71b854be9e0d.tar.gz
coredns-ffcd2f61cfc2290b23e92c9123cf71b854be9e0d.tar.zst
coredns-ffcd2f61cfc2290b23e92c9123cf71b854be9e0d.zip
Publish metadata from kubernetes plugin (#2829)
* Publish metadata from kubernetes plugin * stickler fix * Add a couple tests * Add metadata section to README * Update plugin/kubernetes/README.md Co-Authored-By: Chris O'Haver <cohaver@infoblox.com> * Address nit
Diffstat (limited to 'plugin/metadata/metadata.go')
-rw-r--r--plugin/metadata/metadata.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugin/metadata/metadata.go b/plugin/metadata/metadata.go
index 4abe57ddf..b3f803eab 100644
--- a/plugin/metadata/metadata.go
+++ b/plugin/metadata/metadata.go
@@ -20,10 +20,15 @@ type Metadata struct {
// Name implements the Handler interface.
func (m *Metadata) Name() string { return "metadata" }
+// ContextWithMetadata is exported for use by provider tests
+func ContextWithMetadata(ctx context.Context) context.Context {
+ return context.WithValue(ctx, key{}, md{})
+}
+
// ServeDNS implements the plugin.Handler interface.
func (m *Metadata) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
- ctx = context.WithValue(ctx, key{}, md{})
+ ctx = ContextWithMetadata(ctx)
state := request.Request{W: w, Req: r}
if plugin.Zones(m.Zones).Matches(state.Name()) != "" {