Skip to content

Commit

Permalink
Handle multi-version GKs in resourceSummaries
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <[email protected]>
  • Loading branch information
ArnobKumarSaha committed Jul 12, 2024
1 parent 01757cf commit 7e5c510
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/registry/core/resourcesummary/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package ResourceSummary

import (
"context"
ksets "kmodules.xyz/sets"

Check failure on line 21 in pkg/registry/core/resourcesummary/storage.go

View workflow job for this annotation

GitHub Actions / Build

File is not `goimports`-ed (goimports)
"sort"
"strings"
"time"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7e5c510

Please sign in to comment.