@@ -226,7 +226,7 @@ type ClusterStatus struct {
226226 // Records the current status information of all shardings within the Cluster.
227227 //
228228 // +optional
229- Shardings map [string ]ClusterComponentStatus `json:"shardings,omitempty"`
229+ Shardings map [string ]ClusterShardingStatus `json:"shardings,omitempty"`
230230
231231 // Represents a list of detailed status of the Cluster object.
232232 // Each condition in the list provides real-time information about certain aspect of the Cluster object.
@@ -641,9 +641,9 @@ type ClusterSharding struct {
641641 // between the desired and actual number of shards.
642642 // KubeBlocks provides lifecycle management for sharding, including:
643643 //
644- // - Executing the shardProvision Action defined in the ShardingDefinition when the number of shards increases.
644+ // - Executing the shardAdd Action defined in the ShardingDefinition when the number of shards increases.
645645 // This allows for custom actions to be performed after a new shard is provisioned.
646- // - Executing the shardTerminate Action defined in the ShardingDefinition when the number of shards decreases.
646+ // - Executing the shardRemove Action defined in the ShardingDefinition when the number of shards decreases.
647647 // This enables custom cleanup or data migration tasks to be executed before a shard is terminated.
648648 // Resources and data associated with the corresponding Component will also be deleted.
649649 //
@@ -924,3 +924,95 @@ type ClusterComponentStatus struct {
924924 // +optional
925925 UpToDate bool `json:"upToDate,omitempty"`
926926}
927+
928+ // ClusterShardingStatus records a sharding status.
929+ type ClusterShardingStatus struct {
930+ // Specifies the current state of the sharding.
931+ //
932+ // +optional
933+ Phase ComponentPhase `json:"phase,omitempty"`
934+
935+ // Records detailed information about the sharding in its current phase.
936+ //
937+ // +optional
938+ Message map [string ]string `json:"message,omitempty"`
939+
940+ // Indicates the most recent generation of the sharding state observed.
941+ //
942+ // +optional
943+ ObservedGeneration int64 `json:"observedGeneration,omitempty"`
944+
945+ // Indicates whether the sharding state observed is up-to-date with the desired state.
946+ //
947+ // +optional
948+ UpToDate bool `json:"upToDate,omitempty"`
949+
950+ // Records the name of the sharding definition used.
951+ //
952+ // +optional
953+ ShardingDef string `json:"shardingDef,omitempty"`
954+
955+ // PostProvision records the status of the sharding post-provision action.
956+ //
957+ // +optional
958+ PostProvision * LifecycleActionStatus `json:"postProvision,omitempty"`
959+
960+ // PreTerminate records the status of the sharding pre-terminate action.
961+ //
962+ // +optional
963+ PreTerminate * LifecycleActionStatus `json:"preTerminate,omitempty"`
964+ }
965+
966+ // LifecycleActionStatus records the observed state of a lifecycle-related action.
967+ type LifecycleActionStatus struct {
968+ // Phase is the current phase of the lifecycle action.
969+ //
970+ // +optional
971+ Phase LifecycleActionPhase `json:"phase,omitempty"`
972+
973+ // Reason is a programmatic identifier indicating the reason for the current phase.
974+ // e.g., 'PreconditionNotMet' for Pending phase or 'PrerequisiteFailed' for Skipped phase.
975+ //
976+ // +optional
977+ // Reason string `json:"reason,omitempty"`
978+
979+ // Message is a human-readable message providing details about the current phase.
980+ //
981+ // +optional
982+ Message string `json:"message,omitempty"`
983+
984+ // StartTime records the time when the action started execution.
985+ //
986+ // +optional
987+ StartTime * metav1.Time `json:"startTime,omitempty"`
988+
989+ // CompletionTime records the time when the action reached a terminal state (Succeeded, Failed, or Skipped).
990+ //
991+ // +optional
992+ CompletionTime * metav1.Time `json:"completionTime,omitempty"`
993+ }
994+
995+ // LifecycleActionPhase describes the current phase of a lifecycle-related action.
996+ //
997+ // +enum
998+ // +kubebuilder:validation:Enum={Pending,Running,Succeeded,Failed,Skipped}
999+ type LifecycleActionPhase string
1000+
1001+ const (
1002+ // LifecycleActionPending indicates the action is registered and waiting to be triggered or
1003+ // waiting for its dynamic preconditions to be met.
1004+ LifecycleActionPending LifecycleActionPhase = "Pending"
1005+
1006+ // LifecycleActionRunning indicates the preconditions are met and the action is currently being executed.
1007+ LifecycleActionRunning LifecycleActionPhase = "Running"
1008+
1009+ // LifecycleActionSucceeded indicates the action has completed successfully.
1010+ LifecycleActionSucceeded LifecycleActionPhase = "Succeeded"
1011+
1012+ // LifecycleActionFailed indicates the action has failed during execution or timed out.
1013+ LifecycleActionFailed LifecycleActionPhase = "Failed"
1014+
1015+ // LifecycleActionSkipped indicates the action was intentionally bypassed.
1016+ // Usually occurs if a prerequisite action failed or a permanent condition was not met.
1017+ LifecycleActionSkipped LifecycleActionPhase = "Skipped"
1018+ )
0 commit comments