allow resource.version.group in kubectl

This commit is contained in:
deads2k
2016-03-11 10:21:50 -05:00
parent 7b75495d56
commit 5bd161a9cc
4 changed files with 49 additions and 14 deletions

View File

@@ -79,9 +79,16 @@ func RunExplain(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []st
}
// TODO: We should deduce the group for a resource by discovering the supported resources at server.
gvk, err := mapper.KindFor(unversioned.ParseGroupResource(inModel).WithVersion(""))
if err != nil {
return err
fullySpecifiedGVR, groupResource := unversioned.ParseResourceArg(inModel)
gvk := unversioned.GroupVersionKind{}
if fullySpecifiedGVR != nil {
gvk, _ = mapper.KindFor(*fullySpecifiedGVR)
}
if gvk.IsEmpty() {
gvk, err = mapper.KindFor(groupResource.WithVersion(""))
if err != nil {
return err
}
}
if len(apiVersionString) == 0 {