update -o name format to kind.group/name
This commit is contained in:
@@ -598,10 +598,27 @@ func (b *Builder) SingleResourceType() *Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// mappingFor returns the RESTMapping for the Kind referenced by the resource.
|
||||
// prefers a fully specified GroupVersionResource match. If we don't have one match on GroupResource
|
||||
func (b *Builder) mappingFor(resourceArg string) (*meta.RESTMapping, error) {
|
||||
fullySpecifiedGVR, groupResource := schema.ParseResourceArg(resourceArg)
|
||||
// mappingFor returns the RESTMapping for the Kind given, or the Kind referenced by the resource.
|
||||
// prefers a fully specified GroupVersionKind match. If we don't have one, match on a fully specified
|
||||
// GroupVersionResource, or fallback to a match on GroupResource.
|
||||
func (b *Builder) mappingFor(resourceOrKindArg string) (*meta.RESTMapping, error) {
|
||||
fullySpecifiedGVK, groupKind := schema.ParseKindArg(resourceOrKindArg)
|
||||
if fullySpecifiedGVK == nil {
|
||||
gvk := groupKind.WithVersion("")
|
||||
fullySpecifiedGVK = &gvk
|
||||
}
|
||||
|
||||
if !fullySpecifiedGVK.Empty() {
|
||||
if mapping, err := b.mapper.RESTMapping(fullySpecifiedGVK.GroupKind(), fullySpecifiedGVK.Version); err == nil {
|
||||
return mapping, nil
|
||||
} else {
|
||||
if mapping, err := b.mapper.RESTMapping(groupKind, ""); err == nil {
|
||||
return mapping, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fullySpecifiedGVR, groupResource := schema.ParseResourceArg(resourceOrKindArg)
|
||||
gvk := schema.GroupVersionKind{}
|
||||
if fullySpecifiedGVR != nil {
|
||||
gvk, _ = b.mapper.KindFor(*fullySpecifiedGVR)
|
||||
|
Reference in New Issue
Block a user