add daemonset to all categories

This commit is contained in:
guangxuli 2017-07-26 15:41:47 +08:00
parent d4897e875b
commit 7db36811be
4 changed files with 11 additions and 2 deletions

View File

@ -746,12 +746,12 @@ func TestDiscoveryReplaceAliases(t *testing.T) {
{
name: "all-replacement",
arg: "all",
expected: "pods,replicationcontrollers,services,statefulsets.apps,horizontalpodautoscalers.autoscaling,jobs.batch,cronjobs.batch,deployments.extensions,replicasets.extensions",
expected: "pods,replicationcontrollers,services,statefulsets.apps,horizontalpodautoscalers.autoscaling,jobs.batch,cronjobs.batch,daemonsets.extensions,deployments.extensions,replicasets.extensions",
},
{
name: "alias-in-comma-separated-arg",
arg: "all,secrets",
expected: "pods,replicationcontrollers,services,statefulsets.apps,horizontalpodautoscalers.autoscaling,jobs.batch,cronjobs.batch,deployments.extensions,replicasets.extensions,secrets",
expected: "pods,replicationcontrollers,services,statefulsets.apps,horizontalpodautoscalers.autoscaling,jobs.batch,cronjobs.batch,daemonsets.extensions,deployments.extensions,replicasets.extensions,secrets",
},
}

View File

@ -118,6 +118,7 @@ var legacyUserResources = []schema.GroupResource{
{Group: "autoscaling", Resource: "horizontalpodautoscalers"},
{Group: "batch", Resource: "jobs"},
{Group: "batch", Resource: "cronjobs"},
{Group: "extensions", Resource: "daemonsets"},
{Group: "extensions", Resource: "deployments"},
{Group: "extensions", Resource: "replicasets"},
}

View File

@ -47,6 +47,7 @@ func TestCategoryExpansion(t *testing.T) {
{Resource: "horizontalpodautoscalers", Group: "autoscaling"},
{Resource: "jobs", Group: "batch"},
{Resource: "cronjobs", Group: "batch"},
{Resource: "daemonsets", Group: "extensions"},
{Resource: "deployments", Group: "extensions"},
{Resource: "replicasets", Group: "extensions"},
},

View File

@ -67,6 +67,13 @@ func (r *REST) ShortNames() []string {
return []string{"ds"}
}
var _ rest.CategoriesProvider = &REST{}
// Categories implements the CategoriesProvider interface. Returns a list of categories a resource is part of.
func (r *REST) Categories() []string {
return []string{"all"}
}
// StatusREST implements the REST endpoint for changing the status of a daemonset
type StatusREST struct {
store *genericregistry.Store