• Kubernetes Submit Queue's avatar
    Merge pull request #29930 from ericchiang/rbac-validation-dont-mix-non-resource-urls-and-resources · 16454277
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue
    
    rbac validation: rules can't combine non-resource URLs and regular resources
    
    This PR updates the validation used for RBAC to prevent rules from mixing non-resource URLs and regular resources.
    
    For example the following is no longer valid
    
    ```yml
    kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1alpha1
    metadata:
      name: admins
    rules:
      - apiGroups: ["*"]
        resources: ["*"]
        verbs: ["*"]
        nonResourceURLs: ["*"]
    ```
    
    And must be rewritten as so.
    
    ```yml
    kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1alpha1
    metadata:
      name: admins
    rules:
      - apiGroups: ["*"]
        resources: ["*"]
        verbs: ["*"]
      - nonResourceURLs: ["*"]
        verbs: ["*"]
    ``` 
    
    It also:
    * Mandates non-zero length arrays for required resources.
    * Mandates non-resource URLs only be used for ClusterRoles (not namespaced Roles).
    * Updates the swagger validation so `verbs` are the only required field in a rule. Further validation is done by the server.
    
    Also, do we need to bump the API version?
    
    Discussed by @erictune and @liggitt  in #28304
    
    Updates kubernetes/features#2
    
    cc @kubernetes/sig-auth 
    
    Edit:
    * Need to update the RBAC docs if this change goes in.
    16454277
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api/swagger-spec Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
contrib Loading commit data...
docs Loading commit data...
examples Loading commit data...
federation Loading commit data...
hack Loading commit data...
hooks Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
release Loading commit data...
test Loading commit data...
third_party Loading commit data...
vendor Loading commit data...
www Loading commit data...
.generated_docs Loading commit data...
.gitignore Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIB.md Loading commit data...
CONTRIBUTING.md Loading commit data...
DESIGN.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.generated_files Loading commit data...
README.md Loading commit data...
Vagrantfile Loading commit data...
code-of-conduct.md Loading commit data...
labels.yaml Loading commit data...