mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
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:
commit
56779576f0
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user