|
34 | 34 | unschedulableReplicaEstimators = map[string]UnschedulableReplicaEstimator{} |
35 | 35 | ) |
36 | 36 |
|
37 | | -// ReplicaEstimator is an estimator which estimates the maximum replicas that can be applied to the target cluster. |
| 37 | +// ReplicaEstimator estimates how many replicas a workload can run on each target cluster, |
| 38 | +// based on resource availability and node constraints. |
38 | 39 | type ReplicaEstimator interface { |
| 40 | + // MaxAvailableReplicas returns the maximum number of replicas of a single-component workload that each cluster can host. |
39 | 41 | MaxAvailableReplicas(ctx context.Context, clusters []*clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) ([]workv1alpha2.TargetCluster, error) |
| 42 | + // MaxAvailableComponentSets returns the maximum number of complete multi-component sets (in terms of replicas) that each cluster can host. |
| 43 | + MaxAvailableComponentSets(ctx context.Context, req *ComponentSetEstimationRequest) ([]ComponentSetEstimationResponse, error) |
| 44 | +} |
| 45 | + |
| 46 | +// ComponentSetEstimationRequest carries input parameters for estimating multi-component set availability per cluster. |
| 47 | +// Fields can be extended over time without changing the method signature. |
| 48 | +type ComponentSetEstimationRequest struct { |
| 49 | + // Clusters represents a list of feasible clusters to estimate against. |
| 50 | + Clusters []*clusterv1alpha1.Cluster |
| 51 | + // Components are the components that form a multi-component workload. |
| 52 | + Components []*workv1alpha2.Component |
| 53 | + // Namespace is the namespace of the workload being estimated. |
| 54 | + // It is used by the accurate estimator to check the quota configurations |
| 55 | + // in the target member cluster. This field is required for quota-aware estimation. |
| 56 | + Namespace string |
| 57 | +} |
| 58 | + |
| 59 | +// ComponentSetEstimationResponse represents how many complete component sets a cluster can accommodate. |
| 60 | +type ComponentSetEstimationResponse struct { |
| 61 | + // Name is the cluster name. |
| 62 | + Name string |
| 63 | + // Sets is the maximum number of complete component sets that can be scheduled on the cluster. |
| 64 | + Sets int32 |
40 | 65 | } |
41 | 66 |
|
42 | 67 | // UnschedulableReplicaEstimator is an estimator which estimates the unschedulable replicas which belong to a specified workload. |
|
0 commit comments