Skip to content

Commit 31846a5

Browse files
doc: add note to described the possibility to use MultiNamespacedCach… (#2281)
1 parent aad1a1e commit 31846a5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/user-guide.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ By default this will be the namespace that the operator is running in. To watch
6363
mgr, err := manager.New(cfg, manager.Options{Namespace: ""})
6464
```
6565

66+
It is also possible to use the [MultiNamespacedCacheBuilder][multi-namespaced-cache-builder] to watch a specific set of namespaces:
67+
```Go
68+
var namespaces []string // List of Namespaces
69+
// Create a new Cmd to provide shared dependencies and start components
70+
mgr, err := manager.New(cfg, manager.Options{
71+
NewCache: cache.MultiNamespacedCacheBuilder(namespaces),
72+
MapperProvider: restmapper.NewDynamicRESTMapper,
73+
MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
74+
})
75+
```
76+
6677
By default the main program will set the manager's namespace using the value of `WATCH_NAMESPACE` env defined in `deploy/operator.yaml`.
6778

6879
## Add a new Custom Resource Definition
@@ -668,3 +679,4 @@ When the operator is not running in a cluster, the Manager will return an error
668679
[result_go_doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/reconcile#Result
669680
[metrics_doc]: ./user/metrics/README.md
670681
[quay_link]: https://quay.io
682+
[multi-namespaced-cache-builder]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/cache#MultiNamespacedCacheBuilder

0 commit comments

Comments
 (0)