Add warnings for use of Alpha features with Emulated Version

Warn for both api and feature flag use of alpha features with emulated versions. This is an unsupported use case and users may run into issues.

Signed-off-by: Michael Aspinwall <maspinwall@google.com>

Kubernetes-commit: ce86fca8cd55eab2747ce32c432bcbdeafab099a
This commit is contained in:
Michael Aspinwall 2025-06-12 22:35:45 +00:00 committed by Kubernetes Publisher
parent 09d5e11cc1
commit f712448f86
1 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import (
"k8s.io/apiserver/pkg/server/resourceconfig"
serverstore "k8s.io/apiserver/pkg/server/storage"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/klog/v2"
)
// APIEnablementOptions contains the options for which resources to turn on and off.
@ -105,6 +106,14 @@ func (s *APIEnablementOptions) ApplyTo(c *server.Config, defaultResourceConfig *
c.MergedResourceConfig = mergedResourceConfig
if c.EffectiveVersion.BinaryVersion() != c.EffectiveVersion.EmulationVersion() {
for _, version := range registry.PrioritizedVersionsAllGroups() {
if strings.Contains(version.Version, "alpha") {
klog.Warning("alpha api enabled with emulated groupVersion, this is unsupported, proceed at your own risk: api=", version.String())
}
}
}
return err
}