Merge pull request #130930 from siyuanfoundation/help

chore: update emulation version help msg.

Kubernetes-commit: b4c6895d0b0a913e3461bdc78358aa9514604b8f
This commit is contained in:
Kubernetes Publisher 2025-03-19 17:54:58 -07:00
commit 3a206e1457
3 changed files with 10 additions and 6 deletions

2
go.mod
View File

@ -51,7 +51,7 @@ require (
k8s.io/api v0.0.0-20250319213039-6b142a213afd
k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd
k8s.io/client-go v0.0.0-20250319213423-b0ed7301c5de
k8s.io/component-base v0.0.0-20250319214529-fdef30f29c5a
k8s.io/component-base v0.0.0-20250320013750-4906cf71e3c5
k8s.io/klog/v2 v2.130.1
k8s.io/kms v0.0.0-20250308014716-89c23671c056
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff

4
go.sum
View File

@ -373,8 +373,8 @@ k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd h1:KoXgjwEokLM8o95kMxowg5
k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd/go.mod h1:D2UW665TVSpInyOuG6C+PMtC1MZheP0KQz65UPQEiI4=
k8s.io/client-go v0.0.0-20250319213423-b0ed7301c5de h1:g07flpDMKdUPeXcMejYRAXvDkM11BaEMfLJMlACJu5E=
k8s.io/client-go v0.0.0-20250319213423-b0ed7301c5de/go.mod h1:mXZyivI7eM6XOlLcqYNrgTSYKl/zQI+PnQp9Jan6tNE=
k8s.io/component-base v0.0.0-20250319214529-fdef30f29c5a h1:WJov8mJq1N0ZR4L+H6MzOFDPVNZsa3+BY/1VMBqa+F0=
k8s.io/component-base v0.0.0-20250319214529-fdef30f29c5a/go.mod h1:m8hCxocIntSfb4M3aX9CirJDLE6KJ69v7KhwRW3NzBQ=
k8s.io/component-base v0.0.0-20250320013750-4906cf71e3c5 h1:sBfGgwMUXJmLQX3E1OmqUGv3gYYQ8FWslmV/L2HtLb8=
k8s.io/component-base v0.0.0-20250320013750-4906cf71e3c5/go.mod h1:ouCCSR6YA6K2ytcrWVnI4cqLmlmBK+aGivLR4FhrmJU=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kms v0.0.0-20250308014716-89c23671c056 h1:gbxlOdJXB8kVFrYsdlutvYMKCwkMvHuz7Z/k0dBvR1s=

View File

@ -66,6 +66,9 @@ type ResourceExpirationEvaluator interface {
type ResourceExpirationEvaluatorOptions struct {
// CurrentVersion is the current version of the apiserver.
CurrentVersion *apimachineryversion.Version
// Prerelease holds an optional prerelease portion of the version.
// This is used to determine if the current binary is an alpha.
Prerelease string
// EmulationForwardCompatible indicates whether the apiserver should serve resources that are introduced after the current version,
// when resources of the same group and resource name but with lower priority are served.
EmulationForwardCompatible bool
@ -76,7 +79,8 @@ type ResourceExpirationEvaluatorOptions struct {
func NewResourceExpirationEvaluator(currentVersion *apimachineryversion.Version) (ResourceExpirationEvaluator, error) {
opts := ResourceExpirationEvaluatorOptions{
CurrentVersion: currentVersion,
CurrentVersion: apimachineryversion.MajorMinor(currentVersion.Major(), currentVersion.Minor()),
Prerelease: currentVersion.PreRelease(),
}
return NewResourceExpirationEvaluatorFromOptions(opts)
}
@ -94,8 +98,8 @@ func NewResourceExpirationEvaluatorFromOptions(opts ResourceExpirationEvaluatorO
}
// Only keeps the major and minor versions from input version.
ret.currentVersion = apimachineryversion.MajorMinor(currentVersion.Major(), currentVersion.Minor())
ret.isAlpha = strings.Contains(currentVersion.PreRelease(), "alpha")
ret.isAlphaZero = strings.Contains(currentVersion.PreRelease(), "alpha.0")
ret.isAlpha = strings.Contains(opts.Prerelease, "alpha")
ret.isAlphaZero = strings.Contains(opts.Prerelease, "alpha.0")
if envString, ok := os.LookupEnv("KUBE_APISERVER_STRICT_REMOVED_API_HANDLING_IN_ALPHA"); !ok {
// do nothing