Commit eac49159 authored by Mayank Kumar's avatar Mayank Kumar

fix userid validation

parent c9c69013
...@@ -4813,8 +4813,8 @@ func ValidateSecurityContext(sc *core.SecurityContext, fldPath *field.Path) fiel ...@@ -4813,8 +4813,8 @@ func ValidateSecurityContext(sc *core.SecurityContext, fldPath *field.Path) fiel
} }
if sc.RunAsUser != nil { if sc.RunAsUser != nil {
if *sc.RunAsUser < 0 { for _, msg := range validation.IsValidUserID(*sc.RunAsUser) {
allErrs = append(allErrs, field.Invalid(fldPath.Child("runAsUser"), *sc.RunAsUser, isNegativeErrorMsg)) allErrs = append(allErrs, field.Invalid(fldPath.Child("runAsUser"), *sc.RunAsUser, msg))
} }
} }
......
...@@ -11752,7 +11752,7 @@ func TestValidateSecurityContext(t *testing.T) { ...@@ -11752,7 +11752,7 @@ func TestValidateSecurityContext(t *testing.T) {
"negative RunAsUser": { "negative RunAsUser": {
sc: negativeRunAsUser, sc: negativeRunAsUser,
errorType: "FieldValueInvalid", errorType: "FieldValueInvalid",
errorDetail: isNegativeErrorMsg, errorDetail: "must be between",
}, },
} }
for k, v := range errorCases { for k, v := range errorCases {
......
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