package compatibility
import "k8s.io/apiserver/pkg/util/compatibility"
Index ¶
- Variables
- func DefaultBuildEffectiveVersion() basecompatibility.MutableEffectiveVersion
- func DefaultKubeEffectiveVersionForTest() basecompatibility.MutableEffectiveVersion
Variables ¶
var DefaultComponentGlobalsRegistry basecompatibility.ComponentGlobalsRegistry = basecompatibility.NewComponentGlobalsRegistry()
DefaultComponentGlobalsRegistry is the global var to store the effective versions and feature gates for all components for easy access. Example usage: // register the component effective version and feature gate first wardleEffectiveVersion := basecompatibility.NewEffectiveVersion("1.2") wardleFeatureGate := featuregate.NewFeatureGate() utilruntime.Must(compatibility.DefaultComponentGlobalsRegistry.Register(apiserver.WardleComponentName, wardleEffectiveVersion, wardleFeatureGate, false))
cmd := &cobra.Command{ ... // call DefaultComponentGlobalsRegistry.Set() in PersistentPreRunE to ensure the feature gates are set based on emulation version right after parsing the flags. PersistentPreRunE: func(*cobra.Command, []string) error { if err := compatibility.DefaultComponentGlobalsRegistry.Set(); err != nil { return err } ... }, RunE: func(c *cobra.Command, args []string) error { // call compatibility.DefaultComponentGlobalsRegistry.Validate() somewhere }, }
flags := cmd.Flags() // add flags compatibility.DefaultComponentGlobalsRegistry.AddFlags(flags)
Functions ¶
func DefaultBuildEffectiveVersion ¶
func DefaultBuildEffectiveVersion() basecompatibility.MutableEffectiveVersion
DefaultBuildEffectiveVersion returns the MutableEffectiveVersion based on the current build information.
func DefaultKubeEffectiveVersionForTest ¶
func DefaultKubeEffectiveVersionForTest() basecompatibility.MutableEffectiveVersion
DefaultKubeEffectiveVersionForTest returns the MutableEffectiveVersion based on the latest K8s release hardcoded in DefaultKubeBinaryVersion. DefaultKubeBinaryVersion is hard coded because defaultBuildBinaryVersion would return 0.0 when test is run without a git tag. We do not enforce the N-3..N emulation version range in tests so that the tests would not automatically fail when there is a version bump. Only used in tests.
Source Files ¶
registry.go version.go
- Version
- v0.33.1 (latest)
- Published
- May 15, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 9 hours ago –
Tools for package owners.