Merge pull request #47897 from xilabao/dead-code-in-rbac-helper

Automatic merge from submit-queue (batch tested with PRs 49238, 49595, 43494, 47897, 48905)

remove dead code in rbac helper

**What this PR does / why we need it**:
validated in `case len(r.PolicyRule.NonResourceURLs) > 0:` .

**Which issue this PR fixes**: #49540

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-07-28 02:13:02 -07:00 committed by GitHub
commit 7988797233

View File

@ -215,9 +215,8 @@ func (r *PolicyRuleBuilder) Rule() (PolicyRule, error) {
return PolicyRule{}, fmt.Errorf("non-resource rule may not have apiGroups, resources, or resourceNames: %#v", r.PolicyRule) return PolicyRule{}, fmt.Errorf("non-resource rule may not have apiGroups, resources, or resourceNames: %#v", r.PolicyRule)
} }
case len(r.PolicyRule.Resources) > 0: case len(r.PolicyRule.Resources) > 0:
if len(r.PolicyRule.NonResourceURLs) != 0 { // resource rule may not have nonResourceURLs
return PolicyRule{}, fmt.Errorf("resource rule may not have nonResourceURLs: %#v", r.PolicyRule)
}
if len(r.PolicyRule.APIGroups) == 0 { if len(r.PolicyRule.APIGroups) == 0 {
// this a common bug // this a common bug
return PolicyRule{}, fmt.Errorf("resource rule must have apiGroups: %#v", r.PolicyRule) return PolicyRule{}, fmt.Errorf("resource rule must have apiGroups: %#v", r.PolicyRule)