Skip to content

Commit

Permalink
Merge pull request #326 from DirectXMan12/bug/inject-into-mapper
Browse files Browse the repository at this point in the history
🐛 Ensure that enqueuemapped's mapper gets deps
  • Loading branch information
k8s-ci-robot committed May 17, 2019
2 parents fe0f6dd + c1cf624 commit 13bd9ee
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/handler/enqueue_mapped.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"k8s.io/client-go/util/workqueue"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/runtime/inject"
)

var _ EventHandler = &EnqueueRequestsFromMapFunc{}
Expand Down Expand Up @@ -68,6 +69,16 @@ func (e *EnqueueRequestsFromMapFunc) mapAndEnqueue(q workqueue.RateLimitingInter
}
}

// EnqueueRequestsFromMapFunc can inject fields into the mapper.

// InjectFunc implements inject.Injector.
func (e *EnqueueRequestsFromMapFunc) InjectFunc(f inject.Func) error {
if f == nil {
return nil
}
return f(e.ToRequests)
}

// Mapper maps an object to a collection of keys to be enqueued
type Mapper interface {
// Map maps an object
Expand Down

0 comments on commit 13bd9ee

Please sign in to comment.