Skip to content

Commit c44fc28

Browse files
committed
apiserver/validation: fix some sets.NewString deprecations
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
1 parent 4024390 commit c44fc28

File tree

3 files changed

+74
-74
lines changed

3 files changed

+74
-74
lines changed

pkg/kubeapiserver/authorizer/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ func LoadAndValidateData(data []byte, compiler authorizationcel.Compiler, requir
177177

178178
// validate the file and return any error
179179
if errors := validation.ValidateAuthorizationConfiguration(compiler, nil, authorizationConfiguration,
180-
sets.NewString(modes.AuthorizationModeChoices...),
181-
sets.NewString(repeatableAuthorizerTypes...),
180+
sets.New(modes.AuthorizationModeChoices...),
181+
sets.New(repeatableAuthorizerTypes...),
182182
); len(errors) != 0 {
183183
return nil, errors.ToAggregate()
184184
}

staging/src/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ func compileUserCELExpression(compiler authenticationcel.Compiler, expression au
613613
}
614614

615615
// ValidateAuthorizationConfiguration validates a given AuthorizationConfiguration.
616-
func ValidateAuthorizationConfiguration(compiler authorizationcel.Compiler, fldPath *field.Path, c *api.AuthorizationConfiguration, knownTypes sets.String, repeatableTypes sets.String) field.ErrorList {
616+
func ValidateAuthorizationConfiguration(compiler authorizationcel.Compiler, fldPath *field.Path, c *api.AuthorizationConfiguration, knownTypes sets.Set[string], repeatableTypes sets.Set[string]) field.ErrorList {
617617
allErrs := field.ErrorList{}
618618

619619
if len(c.Authorizers) == 0 {
@@ -630,7 +630,7 @@ func ValidateAuthorizationConfiguration(compiler authorizationcel.Compiler, fldP
630630
continue
631631
}
632632
if !knownTypes.Has(aType) {
633-
allErrs = append(allErrs, field.NotSupported(fldPath.Child("type"), aType, knownTypes.List()))
633+
allErrs = append(allErrs, field.NotSupported(fldPath.Child("type"), aType, sets.List(knownTypes)))
634634
continue
635635
}
636636
if seenAuthorizerTypes.Has(aType) && !repeatableTypes.Has(aType) {

0 commit comments

Comments
 (0)