Merge pull request #125986 from vinayakankugoyal/typo

Fix typo in error message for anonymous field in AuthenticationConfig…
This commit is contained in:
Kubernetes Prow Robot 2024-07-09 20:45:05 -07:00 committed by GitHub
commit 0c8b3e5f30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -563,7 +563,7 @@ anonymous:
enabled: false enabled: false
`), `),
}, },
expectErr: "anonymous is not supported when when AnonymousAuthConfigurableEnpoints feature gate is disabled", expectErr: "anonymous is not supported when AnonymousAuthConfigurableEnpoints feature gate is disabled",
}, },
{ {
name: "file-anonymous-disabled-AnonymousAuthConfigurableEndpoints-enabled", name: "file-anonymous-disabled-AnonymousAuthConfigurableEndpoints-enabled",

View File

@ -80,7 +80,7 @@ func ValidateAuthenticationConfiguration(c *api.AuthenticationConfiguration, dis
if c.Anonymous != nil { if c.Anonymous != nil {
if !utilfeature.DefaultFeatureGate.Enabled(features.AnonymousAuthConfigurableEndpoints) { if !utilfeature.DefaultFeatureGate.Enabled(features.AnonymousAuthConfigurableEndpoints) {
allErrs = append(allErrs, field.Forbidden(field.NewPath("anonymous"), "anonymous is not supported when when AnonymousAuthConfigurableEnpoints feature gate is disabled")) allErrs = append(allErrs, field.Forbidden(field.NewPath("anonymous"), "anonymous is not supported when AnonymousAuthConfigurableEnpoints feature gate is disabled"))
} }
if !c.Anonymous.Enabled && len(c.Anonymous.Conditions) > 0 { if !c.Anonymous.Enabled && len(c.Anonymous.Conditions) > 0 {
allErrs = append(allErrs, field.Invalid(field.NewPath("anonymous", "conditions"), c.Anonymous.Conditions, "enabled should be set to true when conditions are defined")) allErrs = append(allErrs, field.Invalid(field.NewPath("anonymous", "conditions"), c.Anonymous.Conditions, "enabled should be set to true when conditions are defined"))