Skip to content

📖 update cache options design to reflect the implementation #3062

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

Merged
merged 1 commit into from
Jan 9, 2025
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
34 changes: 17 additions & 17 deletions designs/cache_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type ByObject struct {
// An empty map prevents this.
//
// This must be unset for cluster-scoped objects.
Namespaces map[string]*Config
Namespaces map[string]Config

// Config will be used for cluster-scoped objects and to default
// Config in the Namespaces field.
Expand All @@ -79,7 +79,7 @@ type ByObject struct {
type Options struct {
// ByObject specifies per-object cache settings. If unset for a given
// object, this will fall through to Default* settings.
ByObject map[client.Object]*ByObject
ByObject map[client.Object]ByObject

// DefaultNamespaces maps namespace names to cache settings. If set, it
// will be used for all objects that have a nil Namespaces setting.
Expand All @@ -91,7 +91,7 @@ type Options struct {
//
// The options in the Config that are nil will be defaulted from
// the respective Default* settings.
DefaultNamespaces map[string]*Config
DefaultNamespaces map[string]Config

// DefaultLabelSelector is the label selector that will be used as
// the default field label selector for everything that doesn't
Expand Down Expand Up @@ -158,14 +158,14 @@ type Options struct {

```
cache.Options{
ByObject: map[client.Object]*cache.ByObject{
ByObject: map[client.Object]cache.ByObject{
&corev1.ConfigMap{}: {
Namespaces: map[string]*cache.Config{
Namespaces: map[string]cache.Config{
"public": {},
"kube-system": {},
},
},
&corev1.Secret{}: {Namespaces: map[string]*Config{
&corev1.Secret{}: {Namespaces: map[string]Config{
"operator": {},
}},
},
Expand All @@ -176,9 +176,9 @@ cache.Options{

```
cache.Options{
ByObject: map[client.Object]*cache.ByObject{
ByObject: map[client.Object]cache.ByObject{
&corev1.ConfigMap{}: {
Namespaces: map[string]*cache.Config{
Namespaces: map[string]cache.Config{
cache.AllNamespaces: nil, // No selector for all namespaces...
"operator": {LabelSelector: labelSelector}, // except for the operator namespace
},
Expand All @@ -192,13 +192,13 @@ cache.Options{

```
cache.Options{
ByObject: map[client.Object]*cache.ByObject{
&appsv1.Deployment: {Namespaces: map[string]*cache.Config{
cache.AllNamespaces: nil,
ByObject: map[client.Object]cache.ByObject{
&appsv1.Deployment: {Namespaces: map[string]cache.Config{
cache.AllNamespaces: {}},
}},
},
DefaultNamespaces: map[string]*cache.Config{
"operator": nil,
DefaultNamespaces: map[string]cache.Config{
"operator": {}},
},
}
```
Expand All @@ -207,7 +207,7 @@ cache.Options{

```
cache.Options{
ByObject: map[client.Object]*cache.ByObject{
ByObject: map[client.Object]cache.ByObject{
&corev1.Node: {LabelSelector: labels.Everything()},
},
DefaultLabelSelector: myLabelSelector,
Expand All @@ -218,9 +218,9 @@ cache.Options{

```
cache.Options{
DefaultNamespaces: map[string]*cache.Config{
"foo": nil,
"bar": nil,
DefaultNamespaces: map[string]cache.Config{
"foo": {},
"bar": {},
}
}
```
Loading