Skip to content

Commit 4e471a0

Browse files
committed
fix typo and format md
Signed-off-by: bzd111 <zxc@bzd111.me>
1 parent f469197 commit 4e471a0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

designs/use-selectors-at-cache.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Filter cache ListWatch using selectors
2-
===================
1+
# Filter cache ListWatch using selectors
2+
33
## Motivation
44

55
Controller-Runtime controllers use a cache to subscribe to events from
@@ -32,6 +32,7 @@ This proposal is related to the following issue [2]
3232

3333
Add a new selector code at `pkg/cache/internal/selector.go` with common structs
3434
and helpers
35+
3536
```golang
3637
package internal
3738

@@ -53,14 +54,12 @@ type Selector struct {
5354
func (s Selector) ApplyToList(listOpts *metav1.ListOptions) {
5455
...
5556
}
56-
57+
```
5758

5859
Add a type alias to `pkg/cache/cache.go` to internal
5960

6061
```golang
61-
6262
type SelectorsByObject internal.SelectorsByObject
63-
6463
```
6564

6665
Extend `cache.Options` as follows:
@@ -79,7 +78,6 @@ Add new builder function that will return a cache constructor using the passed
7978
cache.Options, users can set SelectorsByObject there to filter out cache, it
8079
will convert SelectorByObject to SelectorsByGVK
8180

82-
8381
```golang
8482
func 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

0 commit comments

Comments
 (0)