Skip to content

doc: add note to described the possibility to use MultiNamespacedCach… #2281

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 3 commits into from
Dec 5, 2019
Merged
Changes from 2 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: 11 additions & 0 deletions doc/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ By default this will be the namespace that the operator is running in. To watch
mgr, err := manager.New(cfg, manager.Options{Namespace: ""})
```

It is also possible to use the [MultiNamespacedCacheBuilder](https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/cache#MultiNamespacedCacheBuilder) to watch a specific set of namespaces:
```Go
var namespaces []string // List of Namepsaces
// Create a new Cmd to provide shared dependencies and start components
mgr, err := manager.New(cfg, manager.Options{
NewCache: cache.MultiNamespacedCacheBuilder(namespaces),
MapperProvider: restmapper.NewDynamicRESTMapper,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that kubernetes-sigs/controller-runtime#554 is merged and we've updated to v0.4.0, we should remove our dynamic rest mapper implementation and any references to it.

That can be done in a follow up though.

MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
})
```

By default the main program will set the manager's namespace using the value of `WATCH_NAMESPACE` env defined in `deploy/operator.yaml`.

## Add a new Custom Resource Definition
Expand Down