Skip to content

Commit 1de5a3e

Browse files
authored
Merge pull request #3062 from ranakan19/cache_options
📖 update cache options design to reflect the implementation
2 parents 2484715 + 7abda47 commit 1de5a3e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

designs/cache_options.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type ByObject struct {
6666
// An empty map prevents this.
6767
//
6868
// This must be unset for cluster-scoped objects.
69-
Namespaces map[string]*Config
69+
Namespaces map[string]Config
7070
7171
// Config will be used for cluster-scoped objects and to default
7272
// Config in the Namespaces field.
@@ -79,7 +79,7 @@ type ByObject struct {
7979
type Options struct {
8080
// ByObject specifies per-object cache settings. If unset for a given
8181
// object, this will fall through to Default* settings.
82-
ByObject map[client.Object]*ByObject
82+
ByObject map[client.Object]ByObject
8383
8484
// DefaultNamespaces maps namespace names to cache settings. If set, it
8585
// will be used for all objects that have a nil Namespaces setting.
@@ -91,7 +91,7 @@ type Options struct {
9191
//
9292
// The options in the Config that are nil will be defaulted from
9393
// the respective Default* settings.
94-
DefaultNamespaces map[string]*Config
94+
DefaultNamespaces map[string]Config
9595
9696
// DefaultLabelSelector is the label selector that will be used as
9797
// the default field label selector for everything that doesn't
@@ -158,14 +158,14 @@ type Options struct {
158158

159159
```
160160
cache.Options{
161-
ByObject: map[client.Object]*cache.ByObject{
161+
ByObject: map[client.Object]cache.ByObject{
162162
&corev1.ConfigMap{}: {
163-
Namespaces: map[string]*cache.Config{
163+
Namespaces: map[string]cache.Config{
164164
"public": {},
165165
"kube-system": {},
166166
},
167167
},
168-
&corev1.Secret{}: {Namespaces: map[string]*Config{
168+
&corev1.Secret{}: {Namespaces: map[string]Config{
169169
"operator": {},
170170
}},
171171
},
@@ -176,9 +176,9 @@ cache.Options{
176176

177177
```
178178
cache.Options{
179-
ByObject: map[client.Object]*cache.ByObject{
179+
ByObject: map[client.Object]cache.ByObject{
180180
&corev1.ConfigMap{}: {
181-
Namespaces: map[string]*cache.Config{
181+
Namespaces: map[string]cache.Config{
182182
cache.AllNamespaces: nil, // No selector for all namespaces...
183183
"operator": {LabelSelector: labelSelector}, // except for the operator namespace
184184
},
@@ -192,13 +192,13 @@ cache.Options{
192192

193193
```
194194
cache.Options{
195-
ByObject: map[client.Object]*cache.ByObject{
196-
&appsv1.Deployment: {Namespaces: map[string]*cache.Config{
197-
cache.AllNamespaces: nil,
195+
ByObject: map[client.Object]cache.ByObject{
196+
&appsv1.Deployment: {Namespaces: map[string]cache.Config{
197+
cache.AllNamespaces: {}},
198198
}},
199199
},
200-
DefaultNamespaces: map[string]*cache.Config{
201-
"operator": nil,
200+
DefaultNamespaces: map[string]cache.Config{
201+
"operator": {}},
202202
},
203203
}
204204
```
@@ -207,7 +207,7 @@ cache.Options{
207207

208208
```
209209
cache.Options{
210-
ByObject: map[client.Object]*cache.ByObject{
210+
ByObject: map[client.Object]cache.ByObject{
211211
&corev1.Node: {LabelSelector: labels.Everything()},
212212
},
213213
DefaultLabelSelector: myLabelSelector,
@@ -218,9 +218,9 @@ cache.Options{
218218

219219
```
220220
cache.Options{
221-
DefaultNamespaces: map[string]*cache.Config{
222-
"foo": nil,
223-
"bar": nil,
221+
DefaultNamespaces: map[string]cache.Config{
222+
"foo": {},
223+
"bar": {},
224224
}
225225
}
226226
```

0 commit comments

Comments
 (0)