Skip to content

Commit 67d877d

Browse files
feat: make CRP controller handle RP status (#170)
--------- Signed-off-by: Ryan Zhang <[email protected]>
1 parent df94676 commit 67d877d

25 files changed

+3743
-1360
lines changed

apis/cluster/v1beta1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/placement/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/placement/v1beta1/clusterresourceplacement_types.go

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -934,14 +934,14 @@ type PlacementStatus struct {
934934
// +kubebuilder:validation:Optional
935935
ObservedResourceIndex string `json:"observedResourceIndex,omitempty"`
936936

937-
// PlacementStatuses contains a list of placement status on the clusters that are selected by PlacementPolicy.
937+
// PerClusterPlacementStatuses contains a list of placement status on the clusters that are selected by PlacementPolicy.
938938
// Each selected cluster according to the observed resource placement is guaranteed to have a corresponding placementStatuses.
939939
// In the pickN case, there are N placement statuses where N = NumberOfClusters; Or in the pickFixed case, there are
940940
// N placement statuses where N = ClusterNames.
941941
// In these cases, some of them may not have assigned clusters when we cannot fill the required number of clusters.
942942
// TODO, For pickAll type, considering providing unselected clusters info.
943943
// +kubebuilder:validation:Optional
944-
PlacementStatuses []PerClusterPlacementStatus `json:"placementStatuses,omitempty"`
944+
PerClusterPlacementStatuses []PerClusterPlacementStatus `json:"placementStatuses,omitempty"`
945945

946946
// +patchMergeKey=type
947947
// +patchStrategy=merge
@@ -1295,60 +1295,58 @@ const (
12951295
type ResourcePlacementConditionType string
12961296

12971297
const (
1298-
// ResourcePlacemenScheduledConditionType indicates whether we have successfully scheduled the
1299-
// ResourcePlacemen.
1298+
// ResourcePlacementScheduledConditionType indicates whether we have successfully scheduled the ResourcePlacement.
13001299
// Its condition status can be one of the following:
13011300
// - "True" means we have successfully scheduled the resources to fully satisfy the placement requirement.
13021301
// - "False" means we didn't fully satisfy the placement requirement. We will fill the Reason field.
13031302
// - "Unknown" means we don't have a scheduling decision yet.
1304-
ResourcePlacemenScheduledConditionType ResourcePlacementConditionType = "ResourcePlacemenScheduled"
1303+
ResourcePlacementScheduledConditionType ResourcePlacementConditionType = "ResourcePlacementScheduled"
13051304

1306-
// ResourcePlacemenRolloutStartedConditionType indicates whether the selected resources start rolling out or
1307-
// not.
1305+
// ResourcePlacementRolloutStartedConditionType indicates whether the selected resources start rolling out or not.
13081306
// Its condition status can be one of the following:
13091307
// - "True" means the selected resources successfully start rolling out in all scheduled clusters.
13101308
// - "False" means the selected resources have not been rolled out in all scheduled clusters yet.
13111309
// - "Unknown" means we don't have a rollout decision yet.
1312-
ResourcePlacemenRolloutStartedConditionType ResourcePlacementConditionType = "ResourcePlacemenRolloutStarted"
1310+
ResourcePlacementRolloutStartedConditionType ResourcePlacementConditionType = "ResourcePlacementRolloutStarted"
13131311

1314-
// ResourcePlacemenOverriddenConditionType indicates whether all the selected resources have been overridden
1312+
// ResourcePlacementOverriddenConditionType indicates whether all the selected resources have been overridden
13151313
// successfully before applying to the target cluster.
13161314
// Its condition status can be one of the following:
13171315
// - "True" means all the selected resources are successfully overridden before applying to the target cluster or
13181316
// override is not needed if there is no override defined with the reason of NoOverrideSpecified.
13191317
// - "False" means some of them have failed.
13201318
// - "Unknown" means we haven't finished the override yet.
1321-
ResourcePlacemenOverriddenConditionType ResourcePlacementConditionType = "ResourcePlacemenOverridden"
1319+
ResourcePlacementOverriddenConditionType ResourcePlacementConditionType = "ResourcePlacementOverridden"
13221320

1323-
// ResourcePlacemenWorkSynchronizedConditionType indicates whether the selected resources are created or updated
1321+
// ResourcePlacementWorkSynchronizedConditionType indicates whether the selected resources are created or updated
13241322
// under the per-cluster namespaces (i.e., fleet-member-<member-name>) on the hub cluster.
13251323
// Its condition status can be one of the following:
13261324
// - "True" means all the selected resources are successfully created or updated under the per-cluster namespaces
13271325
// (i.e., fleet-member-<member-name>) on the hub cluster.
13281326
// - "False" means all the selected resources have not been created or updated under the per-cluster namespaces
13291327
// (i.e., fleet-member-<member-name>) on the hub cluster yet.
13301328
// - "Unknown" means we haven't started processing the work yet.
1331-
ResourcePlacemenWorkSynchronizedConditionType ResourcePlacementConditionType = "ResourcePlacemenWorkSynchronized"
1329+
ResourcePlacementWorkSynchronizedConditionType ResourcePlacementConditionType = "ResourcePlacementWorkSynchronized"
13321330

1333-
// ResourcePlacemenAppliedConditionType indicates whether all the selected member clusters have applied
1331+
// ResourcePlacementAppliedConditionType indicates whether all the selected member clusters have applied
13341332
// the selected resources locally.
13351333
// Its condition status can be one of the following:
13361334
// - "True" means all the selected resources are successfully applied to all the target clusters or apply is not needed
13371335
// if there are no cluster(s) selected by the scheduler.
13381336
// - "False" means some of them have failed. We will place some of the detailed failure in the FailedResourcePlacement array.
13391337
// - "Unknown" means we haven't finished the apply yet.
1340-
ResourcePlacemenAppliedConditionType ResourcePlacementConditionType = "ResourcePlacemenApplied"
1338+
ResourcePlacementAppliedConditionType ResourcePlacementConditionType = "ResourcePlacementApplied"
13411339

1342-
// ResourcePlacemenAvailableConditionType indicates whether the selected resources are available on all the
1340+
// ResourcePlacementAvailableConditionType indicates whether the selected resources are available on all the
13431341
// selected member clusters.
13441342
// Its condition status can be one of the following:
13451343
// - "True" means all the selected resources are available on all the selected member clusters.
13461344
// - "False" means some of them are not available yet. We will place some of the detailed failure in the FailedResourcePlacement
13471345
// array.
13481346
// - "Unknown" means we haven't finished the apply yet so that we cannot check the resource availability.
1349-
ResourcePlacemenAvailableConditionType ResourcePlacementConditionType = "ResourcePlacemenAvailable"
1347+
ResourcePlacementAvailableConditionType ResourcePlacementConditionType = "ResourcePlacementAvailable"
13501348

1351-
// ResourcePlacemenDiffReportedConditionType indicates whether Fleet has reported
1349+
// ResourcePlacementDiffReportedConditionType indicates whether Fleet has reported
13521350
// configuration differences between the desired states of resources as kept in the hub cluster
13531351
// and the current states on the all member clusters.
13541352
//
@@ -1357,7 +1355,7 @@ const (
13571355
// * False: Fleet has not yet reported complete sets of configuration differences on some member
13581356
// clusters, or an error has occurred.
13591357
// * Unknown: Fleet has not finished processing the diff reporting yet.
1360-
ResourcePlacemenDiffReportedConditionType ResourcePlacementConditionType = "ResourcePlacemenDiffReported"
1358+
ResourcePlacementDiffReportedConditionType ResourcePlacementConditionType = "ResourcePlacementDiffReported"
13611359
)
13621360

13631361
// PerClusterPlacementConditionType defines a specific condition of a per cluster placement.

apis/placement/v1beta1/zz_generated.deepcopy.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/loadtest/util/help.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func CleanupAll(hubClient client.Client) error {
196196
return nil
197197
}
198198
func getFleetSize(crp v1beta1.ClusterResourcePlacement, clusterNames ClusterNames) (string, ClusterNames, error) {
199-
for _, status := range crp.Status.PlacementStatuses {
199+
for _, status := range crp.Status.PerClusterPlacementStatuses {
200200
if err := clusterNames.Set(status.ClusterName); err != nil {
201201
klog.ErrorS(err, "Failed to set clusterNames.")
202202
return "", nil, err

0 commit comments

Comments
 (0)