compatibility

package
v0.35.0-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 5 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL