Skip to content

Commit 3fcace5

Browse files
committed
fix(kubernetes): remove unneeded CacheInvalidate() method
1 parent 2957faa commit 3fcace5

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

pkg/kubernetes/kubernetes.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,6 @@ func (m *Manager) Derived(ctx context.Context) *Kubernetes {
164164
return derived
165165
}
166166

167-
// TODO: check test to see why cache isn't getting invalidated automatically https://github.com/manusa/kubernetes-mcp-server/pull/125#discussion_r2152194784
168-
func (k *Kubernetes) CacheInvalidate() {
169-
if k.manager.discoveryClient != nil {
170-
k.manager.discoveryClient.Invalidate()
171-
}
172-
if k.manager.deferredDiscoveryRESTMapper != nil {
173-
k.manager.deferredDiscoveryRESTMapper.Reset()
174-
}
175-
}
176-
177167
func (k *Kubernetes) NewHelm() *helm.Helm {
178168
// This is a derived Kubernetes, so it already has the Helm initialized
179169
return helm.NewHelm(k.manager)

pkg/mcp/pods_top_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ func TestPodsTop(t *testing.T) {
1919
// Request Performed by DiscoveryClient to Kube API (Get API Groups legacy -core-)
2020
if req.URL.Path == "/api" {
2121
if !metricsApiAvailable {
22-
2322
_, _ = w.Write([]byte(`{"kind":"APIVersions","versions":[],"serverAddressByClientCIDRs":[{"clientCIDR":"0.0.0.0/0"}]}`))
2423
} else {
2524
_, _ = w.Write([]byte(`{"kind":"APIVersions","versions":["metrics.k8s.io/v1beta1"],"serverAddressByClientCIDRs":[{"clientCIDR":"0.0.0.0/0"}]}`))
@@ -87,7 +86,6 @@ func TestPodsTop(t *testing.T) {
8786
})
8887
// Enable metrics API addon
8988
metricsApiAvailable = true
90-
c.mcpServer.k.Derived(t.Context()).CacheInvalidate() // Force discovery client to refresh
9189
podsTopDefaults, err := c.callTool("pods_top", map[string]interface{}{})
9290
t.Run("pods_top defaults returns pod metrics from all namespaces", func(t *testing.T) {
9391
if err != nil {

0 commit comments

Comments
 (0)