Skip to content
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

How to change DefaultNamespaces at runtime #2829

Closed
lmeunier-talend opened this issue May 15, 2024 · 3 comments
Closed

How to change DefaultNamespaces at runtime #2829

lmeunier-talend opened this issue May 15, 2024 · 3 comments

Comments

@lmeunier-talend
Copy link

lmeunier-talend commented May 15, 2024

Hello

For security reason our operator must only watch certain namespace, in order to do that I have used

Cache: cache.Options{DefaultNamespaces: map[string]cache.Config{
				"namespace1": {},
			}},

when starting the controller and it's working nicely.

But when of our CR is created, we have to watch another namespace.
Is it possible to update the DefaultNamespaces at runtime ? i did not see how

Else i was thinking on relying on a configmap to hold the namespace and restart the operator on change but that kind of sucks

Thanks you for your answer

@sbueringer
Copy link
Member

sbueringer commented May 15, 2024

There is no builtin mechanism today to do this at runtime. It's also quite complex as we would have to adjust the currently running informers according to the changed config.

@lmeunier-talend
Copy link
Author

lmeunier-talend commented May 16, 2024

Thanks for the answer, i will close the ticket then

@csviri
Copy link

csviri commented May 16, 2024

Hi, just our xp with this, this is supported in Java Operator SDK
https://javaoperatorsdk.io/docs/features#dynamically-changing-target-namespaces

basically what happens is that the event processing is stopped until the new informers are started and after sync the processing is started again.

It seems to working well, and helps a lot for some teams, where the controller watches a set of namespaces and this set is sometimes extended with a new namespace, then there is no need to sync again the informers for other namespaces, what might take a long time in case of lot of objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants