feat: add watch-namespace flag to filter namespaces to watch for resources#175
feat: add watch-namespace flag to filter namespaces to watch for resources#175jdheyburn wants to merge 1 commit into
Conversation
…urces Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com>
| flag.BoolVar(&enableHTTP2, "enable-http2", false, | ||
| "If set, HTTP/2 will be enabled for the metrics and webhook servers") | ||
| seenNamespaces := make(map[string]struct{}) | ||
| flag.Func("watch-namespace", "Namespace to watch (repeatable; omit for cluster-wide)", func(s string) error { |
There was a problem hiding this comment.
how can users set this watch-namespace envvar from helm or operator env? i think we need to document that part
There was a problem hiding this comment.
I've got a draft PR for the helm chart here: valkey-io/valkey-helm#172
Is that what you had in mind?
For env var, can any of these arguments today be set via env var? I hadn't had that in scope.
bjosv
left a comment
There was a problem hiding this comment.
Some operators seem to only, or also, use the env. variable WATCH_NAMESPACE, like dragonfly-opeator, cnpg, OT Redis operator and cockroach-operator.
It might be a convention from the Operator SDK, and some state that its simpler with env. than injecting extra args.
An env var would need to be comma separated.
Looking at the helm chart PR which uses your args; your solution seems cleaner.
Closes #178
Summary
Adds a new flag
--watch-namespacethat will limit the resources watched by the managers. This will help to reduce memory usage in larger clusters. The flag can be specified multiple times to limit to multiple namespaces.Features / Behaviour Changes
Lower memory use
Implementation
Limitations
Testing
Tested locally by building the image and deploying to local kind cluster.
Checklist
Before submitting the PR make sure the following are checked:
pre-commit run --all-filesor hooks on commit)