Switch RBAC subject apiVersion to apiGroup in v1beta1
This commit is contained in:
@@ -201,6 +201,9 @@ func validateRoleBindingSubject(subject rbac.Subject, isNamespaced bool, fldPath
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), subject.Name, msg))
|
||||
}
|
||||
}
|
||||
if len(subject.APIGroup) > 0 {
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath.Child("apiGroup"), subject.APIGroup, []string{""}))
|
||||
}
|
||||
if !isNamespaced && len(subject.Namespace) == 0 {
|
||||
allErrs = append(allErrs, field.Required(fldPath.Child("namespace"), ""))
|
||||
}
|
||||
@@ -210,12 +213,18 @@ func validateRoleBindingSubject(subject rbac.Subject, isNamespaced bool, fldPath
|
||||
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}))
|
||||
}
|
||||
|
||||
default:
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath.Child("kind"), subject.Kind, []string{rbac.ServiceAccountKind, rbac.UserKind, rbac.GroupKind}))
|
||||
|
||||
Reference in New Issue
Block a user