spreadconstraint

package
v1.9.0-preview6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// InvalidClusterID indicate a invalid cluster
	InvalidClusterID = -1
	// InvalidReplicas indicate that don't care about the available resource
	InvalidReplicas = -1
)

Variables

This section is empty.

Functions

func GetClusterWithMaxAvailableResource

func GetClusterWithMaxAvailableResource(candidateClusters []ClusterDetailInfo, originReplicas int64) int

GetClusterWithMaxAvailableResource returns the cluster with maxAvailableReplicas

func IsSpreadConstraintExisted

func IsSpreadConstraintExisted(spreadConstraints []policyv1alpha1.SpreadConstraint, field policyv1alpha1.SpreadFieldValue) bool

IsSpreadConstraintExisted judge if the specific field is existed in the spread constraints

func SelectBestClusters

func SelectBestClusters(placement *policyv1alpha1.Placement, groupClustersInfo *GroupClustersInfo, needReplicas int32) ([]*clusterv1alpha1.Cluster, error)

SelectBestClusters selects the cluster set based the GroupClustersInfo and placement

Types

type ClusterDetailInfo

type ClusterDetailInfo struct {
	Name              string
	Score             int64
	AvailableReplicas int64

	Cluster *clusterv1alpha1.Cluster
}

ClusterDetailInfo indicate the cluster information

type GroupClustersInfo

type GroupClustersInfo struct {
	Providers map[string]ProviderInfo
	Regions   map[string]RegionInfo
	Zones     map[string]ZoneInfo

	// Clusters from global view, sorted by cluster.Score descending.
	Clusters []ClusterDetailInfo
	// contains filtered or unexported fields
}

GroupClustersInfo indicate the cluster global view

func GroupClustersWithScore

func GroupClustersWithScore(
	clustersScore framework.ClusterScoreList,
	placement *policyv1alpha1.Placement,
	spec *workv1alpha2.ResourceBindingSpec,
	calAvailableReplicasFunc func(clusters []*clusterv1alpha1.Cluster, spec *workv1alpha2.ResourceBindingSpec) []workv1alpha2.TargetCluster,
) *GroupClustersInfo

GroupClustersWithScore groups cluster base provider/region/zone/cluster

type GroupInfo added in v1.6.0

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

GroupInfo indicate the group info.

type ProviderInfo

type ProviderInfo struct {
	Name              string
	Score             int64 // the highest score in all clusters of the provider
	AvailableReplicas int64

	// Regions under this provider
	Regions map[string]struct{}
	// Zones under this provider
	Zones map[string]struct{}
	// Clusters under this provider, sorted by cluster.Score descending.
	Clusters []ClusterDetailInfo
}

ProviderInfo indicate the provider information

type RegionInfo

type RegionInfo struct {
	Name              string
	Score             int64 // the highest score in all clusters of the region
	AvailableReplicas int64

	// Zones under this provider
	Zones map[string]struct{}
	// Clusters under this region, sorted by cluster.Score descending.
	Clusters []ClusterDetailInfo
}

RegionInfo indicate the region information

type ZoneInfo

type ZoneInfo struct {
	Name              string
	Score             int64 // the highest score in all clusters of the zone
	AvailableReplicas int64

	// Clusters under this zone, sorted by cluster.Score descending.
	Clusters []ClusterDetailInfo
}

ZoneInfo indicate the zone information

Jump to

Keyboard shortcuts

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