File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
website/content/en/docs/building-operators/golang Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,18 @@ See the [Kubebuilder entrypoint doc][kubebuilder_entrypoint_doc] for more detail
39
39
40
40
The Manager can restrict the namespace that all controllers will watch for resources:
41
41
``` Go
42
- mgr , err := manager. New (cfg, manager.Options {Namespace: namespace})
42
+ mgr , err := ctrl. NewManager (cfg, manager.Options {Namespace: namespace})
43
43
```
44
44
By default this will be the namespace that the operator is running in. To watch all namespaces leave the namespace option empty:
45
45
``` Go
46
- mgr , err := manager. New (cfg, manager.Options {Namespace: " " })
46
+ mgr , err := ctrl. NewManager (cfg, manager.Options {Namespace: " " })
47
47
```
48
48
49
49
It is also possible to use the [ MultiNamespacedCacheBuilder] [ multi-namespaced-cache-builder ] to watch a specific set of namespaces:
50
50
``` Go
51
51
var namespaces []string // List of Namespaces
52
52
// Create a new Cmd to provide shared dependencies and start components
53
- mgr , err := manager. New (cfg, manager.Options {
53
+ mgr , err := ctrl. NewManager (cfg, manager.Options {
54
54
NewCache : cache.MultiNamespacedCacheBuilder (namespaces),
55
55
})
56
56
```
You can’t perform that action at this time.
0 commit comments