diff --git a/pkg/apis/resource/structured/namedresources/validation/validation.go b/pkg/apis/resource/structured/namedresources/validation/validation.go index 92748c4edc8..755507c8e86 100644 --- a/pkg/apis/resource/structured/namedresources/validation/validation.go +++ b/pkg/apis/resource/structured/namedresources/validation/validation.go @@ -149,16 +149,10 @@ func validateSelector(opts Options, selector string, fldPath *field.Path) field. if selector == "" { allErrs = append(allErrs, field.Required(fldPath, "")) } else { - // TODO (https://github.com/kubernetes/kubernetes/issues/123687): - // when this API gets promoted to beta, we have to - // validate new and stored expressions differently. - // While it is alpha, new expressions are allowed to - // use everything that is currently available. - // envType := environment.NewExpressions - // if opts.StoredExpressions { - // envType = environment.StoredExpressions - // } - envType := environment.StoredExpressions + envType := environment.NewExpressions + if opts.StoredExpressions { + envType = environment.StoredExpressions + } result := namedresourcescel.Compiler.CompileCELExpression(selector, envType) if result.Error != nil { allErrs = append(allErrs, convertCELErrorToValidationError(fldPath, selector, result.Error)) diff --git a/staging/src/k8s.io/dynamic-resource-allocation/structured/namedresources/cel/compile.go b/staging/src/k8s.io/dynamic-resource-allocation/structured/namedresources/cel/compile.go index b61f1eacd4c..755dcbff10b 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/structured/namedresources/cel/compile.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/structured/namedresources/cel/compile.go @@ -187,7 +187,12 @@ func mustBuildEnv() *environment.EnvSet { envset := environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion()) versioned := []environment.VersionedOptions{ { - IntroducedVersion: version.MajorMinor(1, 30), + // Feature epoch was actually 1.30, but we artificially set it to 1.0 because these + // options should always be present. + // + // TODO (https://github.com/kubernetes/kubernetes/issues/123687): set this + // version properly before going to beta. + IntroducedVersion: version.MajorMinor(1, 0), EnvOptions: append(buildVersionedAttributes(), SemverLib(), ),