File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,22 @@ type Source interface {
55
55
Start (handler.EventHandler , workqueue.RateLimitingInterface , ... predicate.Predicate ) error
56
56
}
57
57
58
+ // NewKindWithCache creates a Source without InjectCache, so that it is assured that the given cache is used
59
+ // and not overwritten. It can be used to watch objects in a different cluster by passing the cache
60
+ // from that other cluster
61
+ func NewKindWithCache (object runtime.Object , cache cache.Cache ) Source {
62
+ return & kindWithCache {kind : Kind {Type : object , cache : cache }}
63
+ }
64
+
65
+ type kindWithCache struct {
66
+ kind Kind
67
+ }
68
+
69
+ func (ks * kindWithCache ) Start (handler handler.EventHandler , queue workqueue.RateLimitingInterface ,
70
+ prct ... predicate.Predicate ) error {
71
+ return ks .kind .Start (handler , queue , prct ... )
72
+ }
73
+
58
74
// Kind is used to provide a source of events originating inside the cluster from Watches (e.g. Pod Create)
59
75
type Kind struct {
60
76
// Type is the type of object to watch. e.g. &v1.Pod{}
You can’t perform that action at this time.
0 commit comments