make shortcut expanding restmapper handle all

This commit is contained in:
deads2k
2016-09-15 08:52:42 -04:00
parent 4359c79f53
commit 771915c6c4
7 changed files with 159 additions and 97 deletions

View File

@@ -86,9 +86,6 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error {
return nil
}
// userResources is a group of resources mostly used by a kubectl user
var userResources = []string{"rc", "svc", "pods", "pvc"}
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper {
// the list of kinds that are scoped at the root of the api hierarchy
// if a kind is not enumerated here, it is assumed to have a namespace scope
@@ -115,8 +112,6 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper
"ThirdPartyResourceList")
mapper := api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped)
// setup aliases for groups of resources
mapper.AddResourceAlias("all", userResources...)
return mapper
}