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

Tracker watching dynamic resource types #84

Open
Samze opened this issue Feb 9, 2021 · 2 comments
Open

Tracker watching dynamic resource types #84

Samze opened this issue Feb 9, 2021 · 2 comments

Comments

@Samze
Copy link
Contributor

Samze commented Feb 9, 2021

Hey Scott,

Something we have done a bunch of times using regular controller-runtime tooling is to setup watches for resources that arn't known about upfront. For example, we might have a CRD that allows for a resource GVK to be defined in the spec, so someone creates a CR configured for the RMQ resource and our controller will inspect that, perhaps create some RMQ resources and want to watch for changes.

It looks like the Tracker object can setup watches dynamically but only if the type is known upfront, as it stands requires a bldr.Watch call in the Setup of the Reconciler, is that correct?

Cheers,
Sam

@scothis
Copy link
Contributor

scothis commented Feb 9, 2021

There's active work in this space. Check out #65.

If that PR fits your needs, we can work to get it merged. The main open issue at the moment is that when we start tracking a new resource, we start an informer which is never stoped until the process terminates. If the set of kinds being watched is stable this isn't an issue, but it can cause additional memory to be consumed to maintain informer caches for resources that aren't actually doing anything.

@Samze
Copy link
Contributor Author

Samze commented Feb 10, 2021

Ah I totally didn't see that, thanks.

Yes, that PR would fit the use case I'm describing. We have some existing components that fit this pattern, so we're not in any sort of hurry - but it would be a useful feature for us writing new reconcilers in the future.

For us, the set of Kinds are fairly dynamic. New CRDs are created at runtime, and watched by our components - however we're not really that concerned with optimisation right now, so if there was a memory leak of informer cache it wouldn't stop us adopting the feature.

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

2 participants