package compatibility
import "k8s.io/component-base/compatibility"
Index ¶
- Constants
- func NewComponentGlobalsRegistry() *componentGlobalsRegistry
- type ComponentGlobals
- type ComponentGlobalsRegistry
- type EffectiveVersion
- type MutableEffectiveVersion
- func NewEffectiveVersion(binaryVersion *version.Version, useDefaultBuildBinaryVersion bool, emulationVersionFloor, minCompatibilityVersionFloor *version.Version) MutableEffectiveVersion
- func NewEffectiveVersionFromString(binaryVer, emulationVerFloor, minCompatibilityVerFloor string) MutableEffectiveVersion
- type VersionMapping
Constants ¶
const ( // DefaultKubeComponent is the component name for k8s control plane components. DefaultKubeComponent = "kube" )
Functions ¶
func NewComponentGlobalsRegistry ¶
func NewComponentGlobalsRegistry() *componentGlobalsRegistry
Types ¶
type ComponentGlobals ¶
type ComponentGlobals struct {
// contains filtered or unexported fields
}
ComponentGlobals stores the global variables for a component for easy access, including feature gate and effective version.
type ComponentGlobalsRegistry ¶
type ComponentGlobalsRegistry interface { // EffectiveVersionFor returns the EffectiveVersion registered under the component. // Returns nil if the component is not registered. EffectiveVersionFor(component string) EffectiveVersion // FeatureGateFor returns the FeatureGate registered under the component. // Returns nil if the component is not registered. FeatureGateFor(component string) featuregate.FeatureGate // Register registers the EffectiveVersion and FeatureGate for a component. // returns error if the component is already registered. Register(component string, effectiveVersion MutableEffectiveVersion, featureGate featuregate.MutableVersionedFeatureGate) error // ComponentGlobalsOrRegister would return the registered global variables for the component if it already exists in the registry. // Otherwise, the provided variables would be registered under the component, and the same variables would be returned. ComponentGlobalsOrRegister(component string, effectiveVersion MutableEffectiveVersion, featureGate featuregate.MutableVersionedFeatureGate) (MutableEffectiveVersion, featuregate.MutableVersionedFeatureGate) // AddFlags adds flags of "--emulated-version" and "--feature-gates" AddFlags(fs *pflag.FlagSet) // Set sets the flags for all global variables for all components registered. // A component's feature gate and effective version would not be updated until Set() is called. Set() error // SetFallback calls Set() if it has never been called. SetFallback() error // Validate calls the Validate() function for all the global variables for all components registered. Validate() []error // Reset removes all stored ComponentGlobals, configurations, and version mappings. Reset() // SetEmulationVersionMapping sets the mapping from the emulation version of one component // to the emulation version of another component. // Once set, the emulation version of the toComponent will be determined by the emulation version of the fromComponent, // and cannot be set from cmd flags anymore. // For a given component, its emulation version can only depend on one other component, no multiple dependency is allowed. SetEmulationVersionMapping(fromComponent, toComponent string, f VersionMapping) error }
ComponentGlobalsRegistry stores the global variables for different components for easy access, including feature gate and effective version of each component.
type EffectiveVersion ¶
type EffectiveVersion interface { // BinaryVersion is the binary version of a component. Tied to a particular binary release. BinaryVersion() *version.Version // EmulationVersion is the version a component emulate its capabilities (APIs, features, ...) of. // If EmulationVersion is set to be different from BinaryVersion, the component will emulate the behavior of this version instead of the underlying binary version. EmulationVersion() *version.Version // MinCompatibilityVersion is the minimum version a component is compatible with (in terms of storage versions, validation rules, ...). MinCompatibilityVersion() *version.Version EqualTo(other EffectiveVersion) bool String() string Validate() []error // AllowedEmulationVersionRange returns the string of the allowed range of emulation version. // Used only for docs/help. AllowedEmulationVersionRange() string // AllowedMinCompatibilityVersionRange returns the string of the allowed range of min compatibility version. // Used only for docs/help. AllowedMinCompatibilityVersionRange() string // Info returns the version information of a component. Info() *apimachineryversion.Info }
EffectiveVersion stores all the version information of a component.
type MutableEffectiveVersion ¶
type MutableEffectiveVersion interface { EffectiveVersion SetEmulationVersion(emulationVersion *version.Version) SetMinCompatibilityVersion(minCompatibilityVersion *version.Version) }
func NewEffectiveVersion ¶
func NewEffectiveVersion(binaryVersion *version.Version, useDefaultBuildBinaryVersion bool, emulationVersionFloor, minCompatibilityVersionFloor *version.Version) MutableEffectiveVersion
NewEffectiveVersion creates a MutableEffectiveVersion from the binaryVersion. If useDefaultBuildBinaryVersion is true, the call of BinaryVersion() will always return the current binary version. NewEffectiveVersion(binaryVersion, true) should only be used if the binary version is dynamic. Otherwise, use NewEffectiveVersion(binaryVersion, false) or NewEffectiveVersionFromString.
func NewEffectiveVersionFromString ¶
func NewEffectiveVersionFromString(binaryVer, emulationVerFloor, minCompatibilityVerFloor string) MutableEffectiveVersion
NewEffectiveVersionFromString creates a MutableEffectiveVersion from the binaryVersion string.
type VersionMapping ¶
Source Files ¶
registry.go version.go
- Version
- v0.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 5 hours ago –
Tools for package owners.