Skip to content

(opt) cache managed cluster DiscoveryClient and RESTMapper#1644

Merged
gianlucam76 merged 1 commit intoprojectsveltos:mainfrom
gianlucam76:restmapper
Mar 15, 2026
Merged

(opt) cache managed cluster DiscoveryClient and RESTMapper#1644
gianlucam76 merged 1 commit intoprojectsveltos:mainfrom
gianlucam76:restmapper

Conversation

@gianlucam76
Copy link
Member

Instead of creating a new DiscoveryClient and RESTMapper every time a resource is deployed, do it once and re-use it.

When a "Kind Not Found" (NoMatchError) occurs, code performs a targeted invalidation. We explicitly call Invalidate() on the DiscoveryClient and Reset() on the RESTMapper to force a fresh fetch from the remote cluster, ensuring newly created CRDs are discovered without requiring a controller restart.

@gianlucam76 gianlucam76 force-pushed the restmapper branch 2 times, most recently from a56a471 to 89d8136 Compare March 14, 2026 18:31
Instead of creating a new DiscoveryClient and RESTMapper every time a resource
is deployed, do it once and re-use it.
When a "Kind Not Found" (NoMatchError) occurs, code performs a targeted invalidation.
We explicitly call Invalidate() on the DiscoveryClient and Reset() on the RESTMapper
to force a fresh fetch from the remote cluster, ensuring newly created CRDs are
discovered without requiring a controller restart.
@gianlucam76 gianlucam76 merged commit 506cf89 into projectsveltos:main Mar 15, 2026
15 of 16 checks passed
@gianlucam76 gianlucam76 deleted the restmapper branch March 15, 2026 08:54
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

Successfully merging this pull request may close these issues.

1 participant