Skip to content

Commit

Permalink
add the observed resource snapshot index in status
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Zhang committed Nov 2, 2023
1 parent 14fd0f2 commit 32ab674
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apis/placement/v1beta1/clusterresourceplacement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 32ab674

Please sign in to comment.