Change:
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks! If the matter is security related, please disclose it privately via --What happened: Currently, the character limit for the usernames set in the field is 20, which is too low, considering that "ContainerAdministrator" is a valid username and it is longer than 20 characters. A user should be able to run containers as Administrator, if needed. What you expected to happen: Users should be able to spawn pods which run as. How to reproduce it (as minimally and precisely as possible): WindowsRunAsUserName feature gate. () Anything else we need to know?: /sig windows /priority important-soon /milestone 1.16 Environment: Kubernetes version (use ): 1.16 Cloud provider or hardware configuration: N/A OS (e.g: ): Windows Server 2019 Kernel (e.g. ): N/A Install tools: N/A Network plugin and version (if this is a network-related bug): N/A Others:
You must be a member of the GitHub team to set the milestone. If you believe you should be able to issue the /milestone command, please contact your and have them propose you as an additional delegate for this responsibility. <detailsIn response to : <!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks! --2. ` /priority important-soon /milestone 1.16 Kubernetes version (use ): 1.16 Cloud provider or hardware configuration: N/A OS (e.g: ): Windows Server 2019 Kernel (e.g. ): N/A Install tools: N/A Network plugin and version (if this is a network-related bug): N/A Others: </details
/milestone v1.16

Discussion:
// is the max character length for the USER itself. Both the DOMAIN and USER have their // own restrictions, and more information about them can be found here: // https://support.microsoft.com/en-us/help/909264/naming-conventions-in-active-directory-for-computers-domains-sites-and <del> // https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.localaccounts/new-localuser?view=powershell-5.1 </del> <ins> // https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/bb726984(v=technet.10) </ins> const ( maxGMSACredentialSpecLengthInKiB = 64 maxGMSACredentialSpecLength      = maxGMSACredentialSpecLengthInKiB * 1024 maxRunAsUserNameDomainLength     = 256 <del> maxRunAsUserNameUserLength       = 21 </del> <ins> maxRunAsUserNameUserLength       = 104 </ins> ) var (

if l := len(user); l == 0 { errMsg := fmt.Sprintf("runAsUserName's User cannot be empty") allErrs = append(allErrs, field.Invalid(fieldPath.Child("runAsUserName"), windowsOptions.RunAsUserName, errMsg)) <del> } else if l >= maxRunAsUserNameUserLength { errMsg := fmt.Sprintf("runAsUserName's User length must be under %d characters", maxRunAsUserNameUserLength) </del> <ins> } else if l > maxRunAsUserNameUserLength { errMsg := fmt.Sprintf("runAsUserName's User length must not be longer than %d characters", maxRunAsUserNameUserLength) </ins> allErrs = append(allErrs, field.Invalid(fieldPath.Child("runAsUserName"), windowsOptions.RunAsUserName, errMsg)) }

{ testName: "RunAsUserName's User is too long", windowsOptions: &core.WindowsSecurityContextOptions{ <del> RunAsUserName: toPtr(strings.Repeat("a", maxRunAsUserNameUserLength)), </del> <ins> RunAsUserName: toPtr(strings.Repeat("a", maxRunAsUserNameUserLength+1)), </ins> }, <del> expectedErrorSubstring: "runAsUserName's User length must be under", </del> <ins> expectedErrorSubstring: "runAsUserName's User length must not be longer than", </ins> }, { testName: "RunAsUserName's User cannot contain only spaces or periods",