Unverified Commit 7a431c31 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #66203 from tanshanshan/fixdup

Automatic merge from submit-queue (batch tested with PRs 66203, 66224). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. remove reduplicative validate **What this PR does / why we need it**: remove reduplicative validate there's already a global check https://github.com/kubernetes/kubernetes/blob/c861ceb41a239a0c3c0fe767f1f02a721e54ae6b/pkg/apis/rbac/validation/validation.go#L214-L216 so the code below makes these checks redundant https://github.com/kubernetes/kubernetes/blob/c861ceb41a239a0c3c0fe767f1f02a721e54ae6b/pkg/apis/rbac/validation/validation.go#L234-L236 https://github.com/kubernetes/kubernetes/blob/c861ceb41a239a0c3c0fe767f1f02a721e54ae6b/pkg/apis/rbac/validation/validation.go#L243-L245 **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents 4239729f d3007066
......@@ -231,18 +231,12 @@ func ValidateRoleBindingSubject(subject rbac.Subject, isNamespaced bool, fldPath
case rbac.UserKind:
// TODO(ericchiang): What other restrictions on user name are there?
if len(subject.Name) == 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), subject.Name, "user name cannot be empty"))
}
if subject.APIGroup != rbac.GroupName {
allErrs = append(allErrs, field.NotSupported(fldPath.Child("apiGroup"), subject.APIGroup, []string{rbac.GroupName}))
}
case rbac.GroupKind:
// TODO(ericchiang): What other restrictions on group name are there?
if len(subject.Name) == 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), subject.Name, "group name cannot be empty"))
}
if subject.APIGroup != rbac.GroupName {
allErrs = append(allErrs, field.NotSupported(fldPath.Child("apiGroup"), subject.APIGroup, []string{rbac.GroupName}))
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment