Merge pull request #36424 from xilabao/fix-forbid-clusterrole-with-namespace

Automatic merge from submit-queue

fix forbid clusterrole with namespace

run `kubectl get clusterroles --all-namespaces`
old version
return error message:
```
NAMESPACE   NAME      AGE
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
```


```release-note

Add error message when trying to use clusterrole with namespace in kubectl

```
This commit is contained in:
Kubernetes Submit Queue 2016-12-01 00:39:12 -08:00 committed by GitHub
commit 56779576f0

View File

@ -1805,6 +1805,9 @@ func printRoleBindingList(list *rbac.RoleBindingList, w io.Writer, options Print
}
func printClusterRole(clusterRole *rbac.ClusterRole, w io.Writer, options PrintOptions) error {
if options.WithNamespace {
return fmt.Errorf("clusterRole is not namespaced")
}
return printObjectMeta(clusterRole.ObjectMeta, w, options, false)
}