Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update placement doc #79

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@ spec:
- name: v1alpha1
schema:
openAPIV3Schema:
description: "PlacementDecision indicates a decision from a placement PlacementDecision
description: PlacementDecision indicates a decision from a placement PlacementDecision
should has a label cluster.open-cluster-management.io/placement={placement
name} to reference a certain placement. \n If a placement has spec.numberOfClusters
specified, the total number of decisions contained in status.decisions of
PlacementDecisions should always be NumberOfClusters; otherwise, the total
number of decisions should be the number of ManagedClusters which match
the placement requirements. \n Some of the decisions might be empty when
there are no enough ManagedClusters meet the placement requirements."
name} to reference a certain placement.
type: object
properties:
apiVersion:
Expand All @@ -45,8 +40,10 @@ spec:
properties:
decisions:
description: Decisions is a slice of decisions according to a placement
The number of decisions should not be larger than 100
The number of decisions should not be larger than 100. The slice
should not include any empty ClusterDecision.
type: array
maxItems: 100
items:
description: ClusterDecision represents a decision from a placement
An empty ClusterDecision indicates it is not scheduled yet.
Expand All @@ -57,8 +54,8 @@ spec:
properties:
clusterName:
description: ClusterName is the name of the ManagedCluster.
If it is not empty, its value should be unique cross all placement
decisions for the Placement.
Its value should be unique cross all placement decisions for
a certian Placement.
type: string
reason:
description: Reason represents the reason why the ManagedCluster
Expand Down
26 changes: 14 additions & 12 deletions cluster/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,15 @@ type PlacementStatus struct {

const (
// PlacementConditionSatisfied means Placement requirements are satisfied.
// A placement is not satisfied only if there is empty ClusterDecision in the status.decisions
// of PlacementDecisions.
// A placement is not satisfied if
// 1) No ManagedClusterSetBinding is found in the placement namespace;
// 2) ClusterSets in spec is specified and none of them is bound to the placement namespace;
// 3) No memeber ManagedCluster is found for all eligible ManagedClusterSets; A ManagedClusterSet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no ManagedCluster in the ManagedClusterSets specified in the spec. And I do not think you need a and b

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no ManagedCluster in the ManagedClusterSets specified in the spec. And I do not think you need a and b

The above description does not cover the case: placement without Clustersets specified in the spec.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to update a bit on this description?

I think it will be

1) No ManagedClusterSetBinding in the Placement namespace;
2) ClusterSets in the Placement spec is specified and none of them is bound to the namespace of the Placement;
3) No ManagedCluster in the ClusterSets which are specified in the Placement spec or bound to this namespace if ClusterSets is not specified in the Placement spec.
4) No ManagedCluster matches any of the cluster predicates in the Placement spec;
5) NumberOfSelectedClusters in status is less than NumberOfClusters in the Placement spec if it is specified;

// is eligible for a placement if
// a) It is bound to the placement namespace;
// b) And if ClusterSets in spec is specified, it is in the list;
// 4) No ManagedCluster matches any of the cluster predicates of the placement;
// 5) NumberOfClusters in spec is specified and NumberOfSelectedClusters in status is less than it;
PlacementConditionSatisfied string = "PlacementSatisfied"
)

Expand All @@ -303,13 +310,6 @@ type PlacementList struct {
// PlacementDecision indicates a decision from a placement
// PlacementDecision should has a label cluster.open-cluster-management.io/placement={placement name}
// to reference a certain placement.
//
// If a placement has spec.numberOfClusters specified, the total number of decisions contained in
// status.decisions of PlacementDecisions should always be NumberOfClusters; otherwise, the total
// number of decisions should be the number of ManagedClusters which match the placement requirements.
//
// Some of the decisions might be empty when there are no enough ManagedClusters meet the placement
// requirements.
type PlacementDecision struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -322,17 +322,19 @@ type PlacementDecision struct {
// PlacementDecisionStatus represents the current status of the PlacementDecision.
type PlacementDecisionStatus struct {
// Decisions is a slice of decisions according to a placement
// The number of decisions should not be larger than 100
// The number of decisions should not be larger than 100.
// The slice should not include any empty ClusterDecision.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MaxItems=100
// +required
Decisions []ClusterDecision `json:"decisions"`
}

// ClusterDecision represents a decision from a placement
// An empty ClusterDecision indicates it is not scheduled yet.
type ClusterDecision struct {
// ClusterName is the name of the ManagedCluster. If it is not empty, its value should be unique cross all
// placement decisions for the Placement.
// ClusterName is the name of the ManagedCluster. Its value should be unique cross all
// placement decisions for a certian Placement.
// +kubebuilder:validation:Required
// +required
ClusterName string `json:"clusterName"`
Expand Down
6 changes: 3 additions & 3 deletions cluster/v1alpha1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.