Optimized the Kubernetes API calls. ~97% reduction, removed unused code#69
Merged
EdwardCooke merged 3 commits intomainfrom Apr 11, 2026
Merged
Optimized the Kubernetes API calls. ~97% reduction, removed unused code#69EdwardCooke merged 3 commits intomainfrom
EdwardCooke merged 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces Kubernetes API traffic by splitting the cache responsibilities: keeping cluster/hostname cache objects in Kubernetes while moving per-sync/per-event transient data (tracked services, endpoint counts, resource versions) into an in-memory cache, and removing the no-longer-used namespace manager.
Changes:
- Introduce an in-memory
ICacheimplementation (MemoryCache+BasicCache) and a narrowerIKubernetesCacheabstraction backed byKubernetesApiCache. - Remove
INamespaceManager/DefaultNamespaceManagerand adjust service registrations + constructors accordingly. - Optimize
KubernetesApiCache.SynchronizeCachesAsyncby reusing already-listed hostname cache objects.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Vecc.K8s.MultiCluster.Api/Vecc.K8s.MultiCluster.Api.csproj | Bumps dependencies and adds a caching-related package reference. |
| src/Vecc.K8s.MultiCluster.Api/Services/INamespaceManager.cs | Removes unused namespace manager interface. |
| src/Vecc.K8s.MultiCluster.Api/Services/IKubernetesCache.cs | Adds interface for Kubernetes-backed cache operations. |
| src/Vecc.K8s.MultiCluster.Api/Services/IBasicCache.cs | Adds abstraction over in-memory key/value cache. |
| src/Vecc.K8s.MultiCluster.Api/Services/Default/KubernetesApiCache.cs | Narrows responsibility to Kubernetes persistence + tweaks cache sync logic. |
| src/Vecc.K8s.MultiCluster.Api/Services/Default/DefaultServiceManager.cs | Removes namespace manager dependency from constructor. |
| src/Vecc.K8s.MultiCluster.Api/Services/Default/DefaultIngressManager.cs | Removes namespace manager dependency from constructor. |
| src/Vecc.K8s.MultiCluster.Api/Services/Default/DefaultHostnameSynchronizer.cs | Replaces AutoResetEvent gate with a boolean guard for local sync. |
| src/Vecc.K8s.MultiCluster.Api/Services/Default/DefaultCache.cs | New in-memory ICache implementation wrapping IBasicCache + IKubernetesCache. |
| src/Vecc.K8s.MultiCluster.Api/Services/Default/DefaultBasicCache.cs | New IBasicCache implementation backed by Microsoft.Extensions.Caching.Memory. |
| src/Vecc.K8s.MultiCluster.Api/Program.cs | Registers new caching services and removes namespace manager registration. |
| src/Vecc.K8s.MultiCluster.Api.Tests/Services/Default/DefaultServiceManagerTests.cs | Updates constructor usage after dependency removal. |
| src/Vecc.K8s.MultiCluster.Api.Tests/Services/Default/DefaultNamespaceManagerTests.cs | Removes tests for deleted namespace manager. |
| src/Vecc.K8s.MultiCluster.Api.Tests/Services/Default/DefaultIngressManagerTests.cs | Updates constructor usage after dependency removal. |
| src/Vecc.K8s.MultiCluster.Api.Tests/Services/Default/DefaultHostnameSynchronizerTests.cs | Updates constructor usage after dependency removal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9f9d7bb to
21bb1a9
Compare
cookew
approved these changes
Apr 11, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The counts are based on
Results