diff --git a/pkg/util/utils.go b/pkg/util/utils.go index 14b108f37e..837a0fd564 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -143,11 +143,10 @@ func GVRFromType(resourceName string, expectedType interface{}) *schema.GroupVer return nil } apiVersion := expectedType.(*unstructured.Unstructured).Object["apiVersion"].(string) - expectedTypeSlice := strings.Split(apiVersion, "/") - g := expectedTypeSlice[0] - v := expectedTypeSlice[1] - if v == "" /* "" group (core) objects */ { - v = expectedTypeSlice[0] + g, v, found := strings.Cut(apiVersion, "/") + if !found { + g = "core" + v = apiVersion } r := resourceName return &schema.GroupVersionResource{