component-helpersk8s.io/component-helpers/nodedeclaredfeatures Index | Files | Directories

package nodedeclaredfeatures

import "k8s.io/component-helpers/nodedeclaredfeatures"

Index

Variables

var DefaultFramework = New(features.AllFeatures)

Types

type Feature

type Feature = types.Feature

type FeatureGate

type FeatureGate = types.FeatureGate

type FeatureMapper

type FeatureMapper struct {
	// contains filtered or unexported fields
}

FeatureMapper maps feature names to bit positions in a FeatureSet.

func NewFeatureMapper

func NewFeatureMapper(features []string) *FeatureMapper

NewFeatureMapper creates a FeatureMapper from a list of known features.

func (*FeatureMapper) MapSorted

func (m *FeatureMapper) MapSorted(sortedFeatures []string) (FeatureSet, error)

MapSorted creates a FeatureSet from a sorted slice of feature names.

func (*FeatureMapper) MustMapSorted

func (m *FeatureMapper) MustMapSorted(sortedFeatures []string) FeatureSet

MustMapSorted is a convenience wrapper around MapSorted that panics on errors.

func (*FeatureMapper) NewFeatureSet

func (m *FeatureMapper) NewFeatureSet() FeatureSet

NewFeatureSet returns an empty FeatureSet sized to the registered features.

func (*FeatureMapper) TryMap

func (m *FeatureMapper) TryMap(sortedFeatures []string) FeatureSet

TryMap creates a FeatureSet from a sorted slice, ignoring unknown features.

func (*FeatureMapper) Unmap

func (m *FeatureMapper) Unmap(s FeatureSet) ([]string, error)

Unmap returns the names of the features set in the FeatureSet (sorted).

type FeatureRequirements

type FeatureRequirements = types.FeatureRequirements

type FeatureSet

type FeatureSet = bitmap

FeatureSet is a set of node features.

type Framework

type Framework struct {
	*FeatureMapper
	// contains filtered or unexported fields
}

Framework provides functions for discovering node features and inferring pod feature requirements. It is stateful and holds the feature registry.

func New

func New(registry []types.Feature) *Framework

New creates a new instance of the Framework.

func (*Framework) DiscoverNodeFeatures

func (f *Framework) DiscoverNodeFeatures(cfg *types.NodeConfiguration) []string

DiscoverNodeFeatures determines which features from the registry are enabled for a specific node configuration. It returns a sorted, unique list of feature names.

func (*Framework) GetFeatureRequirements

func (f *Framework) GetFeatureRequirements(name string) (*FeatureRequirements, error)

GetFeatureRequirements returns the feature gates that a feature depends on.

func (*Framework) InferForPodScheduling

func (f *Framework) InferForPodScheduling(podInfo *types.PodInfo, targetVersion *version.Version) (FeatureSet, error)

InferForPodScheduling determines which features from the registry are required by a pod scheduling for a given target version.

func (*Framework) InferForPodUpdate

func (f *Framework) InferForPodUpdate(oldPodInfo, newPodInfo *types.PodInfo, targetVersion *version.Version) (FeatureSet, error)

InferForPodUpdate determines which features are required by a pod update operation for a given target version.

func (*Framework) MatchNode

func (f *Framework) MatchNode(requiredFeatures FeatureSet, node *v1.Node) (*MatchResult, error)

MatchNode checks if a node's declared features satisfy the pod's pre-computed requirements. It returns a MatchResult: - IsMatch is true if all requiredFeatures are present in node.status.declaredFeatures. - UnsatisfiedRequirements lists features in requiredFeatures but not in node.status.declaredFeatures.

func (*Framework) MatchNodeFeatureSet

func (f *Framework) MatchNodeFeatureSet(requiredFeatures FeatureSet, nodeFeatures FeatureSet) (*MatchResult, error)

MatchNodeFeatureSet compares a set of required features against a set of features present on a node. It returns a MatchResult: - IsMatch is true if all requiredFeatures are present in nodeFeatures. - UnsatisfiedRequirements lists features in requiredFeatures but not in nodeFeatures.

type MatchResult

type MatchResult struct {
	// IsMatch is true if the node satisfies all feature requirements.
	IsMatch bool
	// UnsatisfiedRequirements lists the specific features that were not met.
	// This field is only populated if IsMatch is false.
	UnsatisfiedRequirements []string
}

MatchResult encapsulates the result of a feature match check.

type NodeConfiguration

type NodeConfiguration = types.NodeConfiguration

type PodInfo

type PodInfo = types.PodInfo

type RuntimeFeatures

type RuntimeFeatures = types.RuntimeFeatures

type StaticConfiguration

type StaticConfiguration = types.StaticConfiguration

Source Files

bitmap.go featureset.go framework.go types.go

Directories

PathSynopsis
nodedeclaredfeatures/features
nodedeclaredfeatures/features/extendwebsocketstokubelet
nodedeclaredfeatures/features/inplacepodresize
nodedeclaredfeatures/features/restartallcontainers
nodedeclaredfeatures/features/usernamespaceshostnetwork
nodedeclaredfeatures/testing
nodedeclaredfeatures/types
Version
v0.36.0 (latest)
Published
Apr 22, 2026
Platform
linux/amd64
Imports
8 packages
Last checked
10 hours ago

Tools for package owners.