Skip to content

Commit

Permalink
Merge pull request #1926 from bzd111/master
Browse files Browse the repository at this point in the history
馃摉 fix typo and format this file
  • Loading branch information
k8s-ci-robot committed Jun 7, 2022
2 parents f469197 + 4e471a0 commit 0c2effb
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions designs/use-selectors-at-cache.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Filter cache ListWatch using selectors
===================
# Filter cache ListWatch using selectors

## Motivation

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

Add a new selector code at `pkg/cache/internal/selector.go` with common structs
and helpers

```golang
package internal

Expand All @@ -53,14 +54,12 @@ type Selector struct {
func (s Selector) ApplyToList(listOpts *metav1.ListOptions) {
...
}

```

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

```golang
type SelectorsByObject internal.SelectorsByObject
```

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


```golang
func BuilderWithOptions(options cache.Options) NewCacheFunc {
...
Expand Down Expand Up @@ -119,7 +117,6 @@ implications of using a different cache than the default one
)
```
[1] https://github.com/nmstate/kubernetes-nmstate/pull/687
[2] https://github.com/kubernetes-sigs/controller-runtime/issues/244
[3] https://github.com/kubernetes-sigs/controller-runtime/pull/1404

0 comments on commit 0c2effb

Please sign in to comment.