Skip to content

Commit

Permalink
fixup! Allow optional VK in CR metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
rexagod committed Nov 4, 2022
1 parent bb1eff0 commit b5d4b01
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/customresourcestate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,13 @@ func generateResources(resources []Resource, opts *options.Options) []Resource {
for _, discoveredResource := range discoveredResources {
var discoveredGroup, discoveredVersion string
arr := strings.Split(discoveredResource.GroupVersion, "/")
if len(arr) == 2 {
switch len(arr) {
case 2:
discoveredGroup, discoveredVersion = arr[0], arr[1]
} else if len(arr) == 1 {
case 1:
/* discoveredGroup will be "" in case of G: "" and V: "v1". */
discoveredVersion = arr[0]
} else {
default:
/* len(arr) < 1 || len(arr) > 2, skip over subresources, eg., scale. */
klog.Errorln("Unexpected GroupVersion:", discoveredResource.GroupVersion)
}
Expand Down

0 comments on commit b5d4b01

Please sign in to comment.