diff --git a/apis/placement/v1beta1/clusterresourceplacement_types.go b/apis/placement/v1beta1/clusterresourceplacement_types.go index 4e614c223..9e280233f 100644 --- a/apis/placement/v1beta1/clusterresourceplacement_types.go +++ b/apis/placement/v1beta1/clusterresourceplacement_types.go @@ -340,6 +340,17 @@ type ClusterResourcePlacementStatus struct { // +optional SelectedResources []ResourceIdentifier `json:"selectedResources,omitempty"` + // ObservedResourceIndex is the resource index of a group of ClusterResourceSnapshot CR that the conditions in the + // ClusterResourcePlacementStatus observe. For example, a condition of `ClusterResourcePlacementSynchronized` type + // is observing the synchronization status of the resources in group of ClusterResourceSnapshot with the $ObservedResourceIndex. + // ClusterResourceSnapshot is used by the ClusterResourcePlacementStatus controller to store a snapshot of selected resources. + // A new resource index is generated each time a new snapshot is taken when the selected resources content changes. + // One resource snapshot can contain multiple clusterResourceSnapshots CRs in order to store large amount of resources. + // One can find all the clusterResourceSnapshot with the observed resource index by + // `kubectl get ClusterResourceSnapshot --selector=kubernetes-fleet.io/resource-index=$ObservedResourceIndex ` + // +optional + ObservedResourceIndex string `json:"observedResourceSnapshots,omitempty"` + // PlacementStatuses contains a list of placement status on the clusters that are selected by PlacementPolicy. // Each selected cluster according to the latest resource placement is guaranteed to have a corresponding placementStatuses. // In the pickN case, there are N placement statuses where N = NumberOfClusters; Or in the pickFixed case, there are @@ -419,6 +430,10 @@ type ResourcePlacementStatus struct { // +optional ClusterName string `json:"clusterName,omitempty"` + // ResourceIndex is the index of the resource snapshot group + // +optional + ResourceIndex *int `json:"ResourceIndex,omitempty"` + // +kubebuilder:validation:MaxItems=100 // FailedResourcePlacements is a list of all the resources failed to be placed to the given cluster. diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml index b1440430a..515ea6bbb 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml @@ -552,6 +552,21 @@ spec: x-kubernetes-list-map-keys: - type x-kubernetes-list-type: map + observedResourceSnapshots: + description: ObservedResourceIndex is the resource index of a group + of ClusterResourceSnapshot CR that the conditions in the ClusterResourcePlacementStatus + observe. For example, a condition of `ClusterResourcePlacementSynchronized` + type is observing the synchronization status of the resources in + group of ClusterResourceSnapshot with the $ObservedResourceIndex. + ClusterResourceSnapshot is used by the ClusterResourcePlacementStatus + controller to store a snapshot of selected resources. A new resource + index is generated each time a new snapshot is taken when the selected + resources content changes. One resource snapshot can contain multiple + clusterResourceSnapshots CRs in order to store large amount of resources. + One can find all the clusterResourceSnapshot with the observed resource + index by `kubectl get ClusterResourceSnapshot --selector=kubernetes-fleet.io/resource-index=$ObservedResourceIndex + ` + type: string placementStatuses: description: PlacementStatuses contains a list of placement status on the clusters that are selected by PlacementPolicy. Each selected @@ -566,6 +581,10 @@ spec: description: ResourcePlacementStatus represents the placement status of selected resources for one target cluster. properties: + ResourceIndex: + description: ResourceIndex is the index of the resource snapshot + group + type: integer clusterName: description: ClusterName is the name of the cluster this resource is assigned to. If it is not empty, its value should be unique