-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(kubernetes): Defer loading namespaces until first use (#4008)
* refactor(kubernetes): Push namespace logic down to V1 and V2 A following commit will simplify the logic for handling namespaces in the kubernetes caching agents. There is a lot of legacy V1 code in groovy that depends on the particular implementation that I don't want to refactor and test as part of this change. In order to restrict the change to V2, push this logic down from the base caching agent to the V1 and V2 caching agents, where it is for now duplicated but will soon be changed in V2. This also makes the KubernetesMetricCachingAgent extend the KubernetesV2CachingAgent rather than the base KubernetesCachingAgent so it can share the new namespace functionality. * refactor(kubernetes): Make namespaces private Change namespaces to be private, and have all the consumers use the accessor (which can be protected instead of public). Also, return an ImmutableList of namespaces rather than a list. * perf(kubernetes): Defer loading namespaces until first use The kubernetes v2 caching agents store a list of namespaces of interest, and have a complex system of calling loadNamespaces() to refresh this list then getNamespaces() to fetch them. It turns out that we always just call loadNamespaces() immediately before a call to getNamespaces() so the cache is doing nothing. Remove the cached namespaces variable and all calls to loadNamespaces(). Instead just have getNamespaces() directly look up the namespaces (which was happening anyway before). The main benefit is that now we can remove the call to loadNamespaces() to prime the cache from the caching agent constructor. This means that caching agents don't need to communicate with the cluster in their constructor, so startup will not be blocked waiting for calls to an unreachable cluster to time out.
- Loading branch information
Showing
6 changed files
with
35 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters