File tree 1 file changed +4
-7
lines changed
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
+
3
3
## Motivation
4
4
5
5
Controller-Runtime controllers use a cache to subscribe to events from
@@ -32,6 +32,7 @@ This proposal is related to the following issue [2]
32
32
33
33
Add a new selector code at ` pkg/cache/internal/selector.go ` with common structs
34
34
and helpers
35
+
35
36
``` golang
36
37
package internal
37
38
@@ -53,14 +54,12 @@ type Selector struct {
53
54
func (s Selector ) ApplyToList (listOpts *metav1 .ListOptions ) {
54
55
...
55
56
}
56
-
57
+ ```
57
58
58
59
Add a type alias to ` pkg/cache/cache.go ` to internal
59
60
60
61
``` golang
61
-
62
62
type SelectorsByObject internal.SelectorsByObject
63
-
64
63
```
65
64
66
65
Extend ` cache.Options ` as follows:
@@ -79,7 +78,6 @@ Add new builder function that will return a cache constructor using the passed
79
78
cache.Options, users can set SelectorsByObject there to filter out cache, it
80
79
will convert SelectorByObject to SelectorsByGVK
81
80
82
-
83
81
``` golang
84
82
func BuilderWithOptions (options cache .Options ) NewCacheFunc {
85
83
...
@@ -119,7 +117,6 @@ implications of using a different cache than the default one
119
117
)
120
118
` ` `
121
119
122
-
123
120
[1] https://github.com/nmstate/kubernetes-nmstate/pull/687
124
121
[2] https://github.com/kubernetes-sigs/controller-runtime/issues/244
125
122
[3] https://github.com/kubernetes-sigs/controller-runtime/pull/1404
You can’t perform that action at this time.
0 commit comments