Documentation ¶
Index ¶
- Constants
- func GetClusterWithMaxAvailableResource(candidateClusters []ClusterDetailInfo, originReplicas int64) int
- func IsSpreadConstraintExisted(spreadConstraints []policyv1alpha1.SpreadConstraint, ...) bool
- func SelectBestClusters(placement *policyv1alpha1.Placement, groupClustersInfo *GroupClustersInfo, ...) ([]*clusterv1alpha1.Cluster, error)
- type ClusterDetailInfo
- type GroupClustersInfo
- type ProviderInfo
- type RegionInfo
- type ZoneInfo
Constants ¶
View Source
const ( // InvalidClusterID indicate a invalid cluster InvalidClusterID = -1 // InvalidRegionID indicate a invalid region InvalidRegionID = -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 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
Click to show internal directories.
Click to hide internal directories.