File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1- Filter cache ListWatch using selectors
2- ===================
1+ # Filter cache ListWatch using selectors
2+
33## Motivation
44
55Controller-Runtime controllers use a cache to subscribe to events from
@@ -32,6 +32,7 @@ This proposal is related to the following issue [2]
3232
3333Add a new selector code at ` pkg/cache/internal/selector.go ` with common structs
3434and helpers
35+
3536``` golang
3637package internal
3738
@@ -53,14 +54,12 @@ type Selector struct {
5354func (s Selector ) ApplyToList (listOpts *metav1 .ListOptions ) {
5455...
5556}
56-
57+ ```
5758
5859Add a type alias to ` pkg/cache/cache.go ` to internal
5960
6061``` golang
61-
6262type SelectorsByObject internal.SelectorsByObject
63-
6463```
6564
6665Extend ` cache.Options ` as follows:
@@ -79,7 +78,6 @@ Add new builder function that will return a cache constructor using the passed
7978cache.Options, users can set SelectorsByObject there to filter out cache, it
8079will convert SelectorByObject to SelectorsByGVK
8180
82-
8381``` golang
8482func BuilderWithOptions (options cache .Options ) NewCacheFunc {
8583...
@@ -119,7 +117,6 @@ implications of using a different cache than the default one
119117 )
120118` ` `
121119
122-
123120[1] https://github.com/nmstate/kubernetes-nmstate/pull/687
124121[2] https://github.com/kubernetes-sigs/controller-runtime/issues/244
125122[3] https://github.com/kubernetes-sigs/controller-runtime/pull/1404
You can’t perform that action at this time.
0 commit comments