Support setting up aliases for groups of resources

Closes #5278
This commit is contained in:
kargakis
2015-04-08 17:05:41 +02:00
parent 8510fc67ff
commit 9d056c6bd8
7 changed files with 86 additions and 0 deletions

View File

@@ -61,6 +61,9 @@ var SelfLinker = runtime.SelfLinker(accessor)
// Kubernetes versions.
var RESTMapper meta.RESTMapper
// userResources is a group of resources mostly used by a kubectl user
var userResources = []string{"rc", "svc", "pods", "pvc"}
// InterfacesFor returns the default Codec and ResourceVersioner for a given version
// string, or an error if the version is not known.
func InterfacesFor(version string) (*meta.VersionInterfaces, error) {
@@ -124,6 +127,9 @@ func init() {
"PersistentVolume": true,
}
// setup aliases for groups of resources
mapper.AddResourceAlias("all", userResources...)
// these kinds should be excluded from the list of resources
ignoredKinds := util.NewStringSet("ListOptions", "DeleteOptions", "Status", "ContainerManifest")