Skip to content

Commit 246c6b8

Browse files
committed
Fix namespaced GVK check to use version
A particular Kind may only be present in a specific version of a group. When querying the RESTMapper we should include the version to ensure the cached group is updated to pick up new versions as needed. Signed-off-by: Griffin Davis <[email protected]>
1 parent e28a842 commit 246c6b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/client/apiutil/apimachinery.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func IsObjectNamespaced(obj runtime.Object, scheme *runtime.Scheme, restmapper m
7272
// IsGVKNamespaced returns true if the object having the provided
7373
// GVK is namespace scoped.
7474
func IsGVKNamespaced(gvk schema.GroupVersionKind, restmapper meta.RESTMapper) (bool, error) {
75-
restmapping, err := restmapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind})
75+
restmapping, err := restmapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)
7676
if err != nil {
7777
return false, fmt.Errorf("failed to get restmapping: %w", err)
7878
}

0 commit comments

Comments
 (0)