mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
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
This commit is contained in:
committed by
Miek Gieben
parent
a1c97f82a6
commit
ffcd2f61cf
@@ -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()) != "" {
|
||||
|
||||
Reference in New Issue
Block a user