cache

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssigningResourceBindingCache added in v1.17.0

type AssigningResourceBindingCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

AssigningResourceBindingCache acts as a temporary buffer for ResourceBindings that have new scheduling decisions ("assigning" state) but are not yet fully reflected in the local Informer cache or member clusters.

func (*AssigningResourceBindingCache) Add added in v1.17.0

Add records a ResourceBinding that has a new scheduling decision committed to the API server. This binding is considered to be in an "assigning" state and will be served by the scheduler as the intended state until its full reflection in the Informer cache and member clusters.

func (*AssigningResourceBindingCache) GetBindings added in v1.17.0

GetBindings returns all currently cached ResourceBindings that are in the "assigning" state, providing the scheduler with the most up-to-date view of pending assignments.

func (*AssigningResourceBindingCache) OnBindingDelete added in v1.17.0

func (b *AssigningResourceBindingCache) OnBindingDelete(binding *workv1alpha2.ResourceBinding)

OnBindingDelete is called when a delete event for a ResourceBinding is received from the Informer.

func (*AssigningResourceBindingCache) OnBindingUpdate added in v1.17.0

func (b *AssigningResourceBindingCache) OnBindingUpdate(binding *workv1alpha2.ResourceBinding)

OnBindingUpdate is called when an update event for a ResourceBinding is received from the Informer. It removes the binding from this temporary cache if the Informer's version has caught up to or surpassed the version we recorded, indicating that the scheduling decision is now reflected in the Informer's state. This means the binding is no longer in the "assigning" state from the cache's perspective.

type Cache

type Cache interface {
	AddCluster(cluster *clusterv1alpha1.Cluster)
	UpdateCluster(cluster *clusterv1alpha1.Cluster)
	DeleteCluster(cluster *clusterv1alpha1.Cluster)
	// Snapshot returns a snapshot of the current clusters info
	Snapshot() Snapshot

	// ResourceBindingIndexer returns the indexer for ResourceBindings, used for advanced scheduling logic.
	ResourceBindingIndexer() cache.Indexer

	// AssigningResourceBindings returns a cache for ResourceBindings that are in the "assigning" state.
	// After the control plane generates scheduling results and commits them to the API server,
	// there is a period before these results are fully propagated to and reflected in the member clusters.
	// This cache stores these "assigning" bindings to provide the scheduler with a more accurate and
	// immediate view of the intended state, enabling more precise decision-making during subsequent scheduling cycles.
	AssigningResourceBindings() *AssigningResourceBindingCache
}

Cache is an interface for scheduler internal cache.

func NewCache

func NewCache(clusterLister clusterlister.ClusterLister, resourceBindingIndexer cache.Indexer) Cache

NewCache instantiates a cache used only by scheduler.

type Snapshot

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

Snapshot is a snapshot of cache ClusterInfo. The scheduler takes a snapshot at the beginning of each scheduling cycle and uses it for its operations in that cycle.

func NewEmptySnapshot

func NewEmptySnapshot() Snapshot

NewEmptySnapshot initializes a Snapshot struct and returns it.

func (*Snapshot) GetCluster added in v0.9.0

func (s *Snapshot) GetCluster(clusterName string) *framework.ClusterInfo

GetCluster returns the given clusters.

func (*Snapshot) GetClusters

func (s *Snapshot) GetClusters() []*framework.ClusterInfo

GetClusters returns all the clusters.

func (*Snapshot) GetReadyClusterNames added in v0.8.0

func (s *Snapshot) GetReadyClusterNames() sets.Set[string]

GetReadyClusterNames returns the clusterNames in ready status.

func (*Snapshot) GetReadyClusters added in v0.3.0

func (s *Snapshot) GetReadyClusters() []*framework.ClusterInfo

GetReadyClusters returns the clusters in ready status.

func (*Snapshot) NumOfClusters

func (s *Snapshot) NumOfClusters() int

NumOfClusters returns the number of clusters.

Jump to

Keyboard shortcuts

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