From 7e5c510295536beb40c4acd7ebf477b023b7b9d4 Mon Sep 17 00:00:00 2001 From: Arnob kumar saha Date: Fri, 12 Jul 2024 20:06:12 +0600 Subject: [PATCH] Handle multi-version GKs in resourceSummaries Signed-off-by: Arnob kumar saha --- pkg/registry/core/resourcesummary/storage.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/registry/core/resourcesummary/storage.go b/pkg/registry/core/resourcesummary/storage.go index f82cc49ac..56a00966c 100644 --- a/pkg/registry/core/resourcesummary/storage.go +++ b/pkg/registry/core/resourcesummary/storage.go @@ -18,6 +18,7 @@ package ResourceSummary import ( "context" + ksets "kmodules.xyz/sets" "sort" "strings" "time" @@ -111,12 +112,21 @@ func (r *Storage) List(ctx context.Context, options *internalversion.ListOptions selector := shared.NewGroupKindSelector(options.LabelSelector) now := time.Now() + universe := ksets.NewGroupKind() + items := make([]rscoreapi.ResourceSummary, 0) for _, gvk := range api.RegisteredTypes() { if !selector.Matches(gvk.GroupKind()) { continue } + gk := gvk.GroupKind() + if universe.Has(gk) { + continue + } else { + universe.Insert(gk) + } + mapping, err := r.kc.RESTMapper().RESTMapping(gvk.GroupKind(), gvk.Version) if meta.IsNoMatchError(err) { continue