fix userid validation

This commit is contained in:
Mayank Kumar 2018-01-08 22:27:29 -08:00
parent c9c6901303
commit eac49159a9
2 changed files with 3 additions and 3 deletions

View File

@ -4813,8 +4813,8 @@ func ValidateSecurityContext(sc *core.SecurityContext, fldPath *field.Path) fiel
}
if sc.RunAsUser != nil {
if *sc.RunAsUser < 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("runAsUser"), *sc.RunAsUser, isNegativeErrorMsg))
for _, msg := range validation.IsValidUserID(*sc.RunAsUser) {
allErrs = append(allErrs, field.Invalid(fldPath.Child("runAsUser"), *sc.RunAsUser, msg))
}
}

View File

@ -11752,7 +11752,7 @@ func TestValidateSecurityContext(t *testing.T) {
"negative RunAsUser": {
sc: negativeRunAsUser,
errorType: "FieldValueInvalid",
errorDetail: isNegativeErrorMsg,
errorDetail: "must be between",
},
}
for k, v := range errorCases {