Skip to content

Commit 05c4bd1

Browse files
committed
update placement doc
Signed-off-by: Yang Le <[email protected]>
1 parent a6845f2 commit 05c4bd1

3 files changed

+24
-25
lines changed

cluster/v1alpha1/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml

+7-10
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,9 @@ spec:
1515
- name: v1alpha1
1616
schema:
1717
openAPIV3Schema:
18-
description: "PlacementDecision indicates a decision from a placement PlacementDecision
18+
description: PlacementDecision indicates a decision from a placement PlacementDecision
1919
should has a label cluster.open-cluster-management.io/placement={placement
20-
name} to reference a certain placement. \n If a placement has spec.numberOfClusters
21-
specified, the total number of decisions contained in status.decisions of
22-
PlacementDecisions should always be NumberOfClusters; otherwise, the total
23-
number of decisions should be the number of ManagedClusters which match
24-
the placement requirements. \n Some of the decisions might be empty when
25-
there are no enough ManagedClusters meet the placement requirements."
20+
name} to reference a certain placement.
2621
type: object
2722
properties:
2823
apiVersion:
@@ -45,8 +40,10 @@ spec:
4540
properties:
4641
decisions:
4742
description: Decisions is a slice of decisions according to a placement
48-
The number of decisions should not be larger than 100
43+
The number of decisions should not be larger than 100. The slice
44+
should not include any empty ClusterDecision.
4945
type: array
46+
maxItems: 100
5047
items:
5148
description: ClusterDecision represents a decision from a placement
5249
An empty ClusterDecision indicates it is not scheduled yet.
@@ -57,8 +54,8 @@ spec:
5754
properties:
5855
clusterName:
5956
description: ClusterName is the name of the ManagedCluster.
60-
If it is not empty, its value should be unique cross all placement
61-
decisions for the Placement.
57+
Its value should be unique cross all placement decisions for
58+
a certian Placement.
6259
type: string
6360
reason:
6461
description: Reason represents the reason why the ManagedCluster

cluster/v1alpha1/types.go

+14-12
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,15 @@ type PlacementStatus struct {
276276

277277
const (
278278
// PlacementConditionSatisfied means Placement requirements are satisfied.
279-
// A placement is not satisfied only if there is empty ClusterDecision in the status.decisions
280-
// of PlacementDecisions.
279+
// A placement is not satisfied if
280+
// 1) No ManagedClusterSetBinding is found in the placement namespace;
281+
// 2) ClusterSets in spec is specified and none of them is bound to the placement namespace;
282+
// 3) No memeber ManagedCluster is found for all eligible ManagedClusterSets; A ManagedClusterSet
283+
// is eligible for a placement if
284+
// a) It is bound to the placement namespace;
285+
// b) And if ClusterSets in spec is specified, it is in the list;
286+
// 4) No ManagedCluster matches any of the cluster predicates of the placement;
287+
// 5) NumberOfClusters in spec is specified and NumberOfSelectedClusters in status is less than it;
281288
PlacementConditionSatisfied string = "PlacementSatisfied"
282289
)
283290

@@ -303,13 +310,6 @@ type PlacementList struct {
303310
// PlacementDecision indicates a decision from a placement
304311
// PlacementDecision should has a label cluster.open-cluster-management.io/placement={placement name}
305312
// to reference a certain placement.
306-
//
307-
// If a placement has spec.numberOfClusters specified, the total number of decisions contained in
308-
// status.decisions of PlacementDecisions should always be NumberOfClusters; otherwise, the total
309-
// number of decisions should be the number of ManagedClusters which match the placement requirements.
310-
//
311-
// Some of the decisions might be empty when there are no enough ManagedClusters meet the placement
312-
// requirements.
313313
type PlacementDecision struct {
314314
metav1.TypeMeta `json:",inline"`
315315
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -322,17 +322,19 @@ type PlacementDecision struct {
322322
// PlacementDecisionStatus represents the current status of the PlacementDecision.
323323
type PlacementDecisionStatus struct {
324324
// Decisions is a slice of decisions according to a placement
325-
// The number of decisions should not be larger than 100
325+
// The number of decisions should not be larger than 100.
326+
// The slice should not include any empty ClusterDecision.
326327
// +kubebuilder:validation:Required
328+
// +kubebuilder:validation:MaxItems=100
327329
// +required
328330
Decisions []ClusterDecision `json:"decisions"`
329331
}
330332

331333
// ClusterDecision represents a decision from a placement
332334
// An empty ClusterDecision indicates it is not scheduled yet.
333335
type ClusterDecision struct {
334-
// ClusterName is the name of the ManagedCluster. If it is not empty, its value should be unique cross all
335-
// placement decisions for the Placement.
336+
// ClusterName is the name of the ManagedCluster. Its value should be unique cross all
337+
// placement decisions for a certian Placement.
336338
// +kubebuilder:validation:Required
337339
// +required
338340
ClusterName string `json:"clusterName"`

cluster/v1alpha1/zz_generated.swagger_doc_generated.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)