Skip to content

Commit

Permalink
Fix namespaced GVK check to use version
Browse files Browse the repository at this point in the history
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 <gcd@ibm.com>
  • Loading branch information
griffindvs committed Jul 3, 2024
1 parent e28a842 commit 246c6b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/client/apiutil/apimachinery.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func IsObjectNamespaced(obj runtime.Object, scheme *runtime.Scheme, restmapper m
// IsGVKNamespaced returns true if the object having the provided
// GVK is namespace scoped.
func IsGVKNamespaced(gvk schema.GroupVersionKind, restmapper meta.RESTMapper) (bool, error) {
restmapping, err := restmapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind})
restmapping, err := restmapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)
if err != nil {
return false, fmt.Errorf("failed to get restmapping: %w", err)
}
Expand Down

0 comments on commit 246c6b8

Please sign in to comment.