Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📖 fix typo and format this file #1926

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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