Apply feedback

This commit is contained in:
Joe Betz 2025-03-10 18:56:54 -04:00
parent 4146900428
commit 2d810ddfa9
2 changed files with 21 additions and 7 deletions

View File

@ -48,8 +48,8 @@ import (
// semver('Three') // error
// semver('Mi') // error
// semver('v1.0.0', true) // Applies normalization to remove the leading "v". Returns a Semver of "1.0.0".
// semver('1.0') // Applies normalization to add the missing patch version. Returns a Semver of "1.0.0"
// semver('01.01.01') // Applies normalization to remove leading zeros. Returns a Semver of "1.1.1"
// semver('1.0', true) // Applies normalization to add the missing patch version. Returns a Semver of "1.0.0"
// semver('01.01.01', true) // Applies normalization to remove leading zeros. Returns a Semver of "1.1.1"
//
// isSemver
//
@ -66,9 +66,9 @@ import (
// isSemver('1.0.0') // returns true
// isSemver('hello') // returns false
// isSemver('v1.0') // returns false (leading "v" is not allowed unless normalization is enabled)
// isSemver('v1.0') // Applies normalization to remove leading "v". returns true
// semver('1.0') // Applies normalization to add the missing patch version. Returns true
// semver('01.01.01') // Applies normalization to remove leading zeros. Returns true
// isSemver('v1.0', true) // Applies normalization to remove leading "v". returns true
// semver('1.0', true) // Applies normalization to add the missing patch version. Returns true
// semver('01.01.01', true) // Applies normalization to remove leading zeros. Returns true
//
// Conversion to Scalars:
//

View File

@ -298,8 +298,6 @@ func newCompiler() *compiler {
EnvOptions: []cel.EnvOption{
cel.Variable(deviceVar, deviceType.CelType()),
library.SemverLib(library.SemverVersion(0)),
// https://pkg.go.dev/github.com/google/cel-go/ext#Bindings
//
// This is useful to simplify attribute lookups because the
@ -312,6 +310,22 @@ func newCompiler() *compiler {
deviceType,
},
},
{
IntroducedVersion: version.MajorMinor(1, 31),
// This library has added to base environment of Kubernetes
// in 1.33 at version 1. It will continue to be available for
// use in this environment, but does not need to be included
// directly since it becomes available indirectly via the base
// environment shared across Kubernetes.
// In Kubernetes 1.34, version 1 feature of this library will
// become available, and will be rollback safe to 1.33.
// TODO: In Kubernetes 1.34: Add compile tests that demonstrate that
// `isSemver("v1.0.0", true)` and `semver("v1.0.0", true)` are supported.
RemovedVersion: version.MajorMinor(1, 33),
EnvOptions: []cel.EnvOption{
library.SemverLib(library.SemverVersion(0)),
},
},
}
envset, err := envset.Extend(versioned...)
if err != nil {