Documentation
¶
Index ¶
- Constants
- func GetClusterWithMaxAvailableResource(candidateClusters []ClusterDetailInfo, originReplicas int64) int
- func IsSpreadConstraintExisted(spreadConstraints []policyv1alpha1.SpreadConstraint, ...) bool
- type ClusterDetailInfo
- type GroupClustersInfo
- type GroupInfo
- type ProviderInfo
- type RegionInfo
- type ZoneInfo
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
Types ¶
type ClusterDetailInfo ¶
type ClusterDetailInfo struct {
Name string
Score int64
// AvailableReplicas equal to the sum of the assigned replicas and the allocatable replicas in the cluster
AvailableReplicas int64
Cluster *clusterv1alpha1.Cluster
//AllocatableReplicas the max allocatable replicas in the cluster
AllocatableReplicas int32
}
ClusterDetailInfo indicate the cluster information
func SelectBestClusters ¶
func SelectBestClusters(placement *policyv1alpha1.Placement, groupClustersInfo *GroupClustersInfo, needReplicas int32) ([]ClusterDetailInfo, error)
SelectBestClusters selects the cluster set based the GroupClustersInfo and placement
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 comprehensive 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 comprehensive 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
Click to show internal directories.
Click to hide internal directories.