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

feat: introduce the available probe and condition #8212

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
7 changes: 7 additions & 0 deletions apis/apps/v1/componentdefinition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,13 @@ type ComponentLifecycleActions struct {
// +optional
RoleProbe *Probe `json:"roleProbe,omitempty"`

// Defines the procedure which is invoked regularly to assess the availability of the component.
//
// Note: This field is immutable once it has been set.
//
// +optional
AvailableProbe *Probe `json:"availableProbe,omitempty"`

// Defines the procedure for a controlled transition of leadership from the current leader to a new replica.
// This approach aims to minimize downtime and maintain availability in systems with a leader-follower topology,
// during events such as planned maintenance or when performing stop, shutdown, restart, or upgrade operations
Expand Down
2 changes: 0 additions & 2 deletions apis/apps/v1/deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,13 @@ func GetComponentTerminalPhases() []ClusterComponentPhase {
RunningClusterCompPhase,
StoppedClusterCompPhase,
FailedClusterCompPhase,
AbnormalClusterCompPhase,
}
}

func GetReconfiguringRunningPhases() []ClusterPhase {
return []ClusterPhase{
RunningClusterPhase,
UpdatingClusterPhase, // enable partial running for reconfiguring
AbnormalClusterPhase,
FailedClusterPhase,
}
}
Expand Down
48 changes: 27 additions & 21 deletions apis/apps/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,44 +44,50 @@ const (
// ClusterComponentPhase defines the phase of a cluster component as represented in cluster.status.components.phase field.
//
// +enum
// +kubebuilder:validation:Enum={Creating,Running,Updating,Stopping,Stopped,Deleting,Failed,Abnormal}
// +kubebuilder:validation:Enum={Creating,Updating,Stopping,Starting,Deleting,Running,Stopped,Failed}
type ClusterComponentPhase string

const (
// CreatingClusterCompPhase indicates the component is being created.
// CreatingClusterCompPhase indicates the component is currently being created.
CreatingClusterCompPhase ClusterComponentPhase = "Creating"

// RunningClusterCompPhase indicates the component has more than zero replicas, and all pods are up-to-date and
// in a 'Running' state.
RunningClusterCompPhase ClusterComponentPhase = "Running"

// UpdatingClusterCompPhase indicates the component has more than zero replicas, and there are no failed pods,
// it is currently being updated.
// UpdatingClusterCompPhase indicates the component is currently being updated.
UpdatingClusterCompPhase ClusterComponentPhase = "Updating"

// StoppingClusterCompPhase indicates the component has zero replicas, and there are pods that are terminating.
// StoppingClusterCompPhase indicates the component is currently being stopped.
StoppingClusterCompPhase ClusterComponentPhase = "Stopping"

// StoppedClusterCompPhase indicates the component has zero replicas, and all pods have been deleted.
StoppedClusterCompPhase ClusterComponentPhase = "Stopped"
// StartingClusterCompPhase indicates the component is currently being started.
StartingClusterCompPhase ClusterComponentPhase = "Starting"

// DeletingClusterCompPhase indicates the component is currently being deleted.
DeletingClusterCompPhase ClusterComponentPhase = "Deleting"

// FailedClusterCompPhase indicates the component has more than zero replicas, but there are some failed pods.
// The component is not functioning.
FailedClusterCompPhase ClusterComponentPhase = "Failed"
// RunningClusterCompPhase indicates all resources of the component are up-to-date and running w/o any failure.
RunningClusterCompPhase ClusterComponentPhase = "Running"

// StoppedClusterCompPhase indicates the component has been stopped, all Pods belonging to the component are terminated.
StoppedClusterCompPhase ClusterComponentPhase = "Stopped"

// AbnormalClusterCompPhase indicates the component has more than zero replicas, but there are some failed pods.
// The component is functioning, but it is in a fragile state.
AbnormalClusterCompPhase ClusterComponentPhase = "Abnormal"
// FailedClusterCompPhase indicates the component encountered some error and did not complete successfully.
FailedClusterCompPhase ClusterComponentPhase = "Failed"
)

const (
ConditionTypeProvisioningStarted = "ProvisioningStarted" // ConditionTypeProvisioningStarted the operator starts resource provisioning to create or change the cluster
ConditionTypeApplyResources = "ApplyResources" // ConditionTypeApplyResources the operator start to apply resources to create or change the cluster
ConditionTypeReplicasReady = "ReplicasReady" // ConditionTypeReplicasReady all pods of components are ready
ConditionTypeReady = "Ready" // ConditionTypeReady all components are running
// ConditionTypeProvisioningStarted the operator starts resource provisioning to create or change the cluster.
ConditionTypeProvisioningStarted = "ProvisioningStarted"

// ConditionTypeApplyResources the operator start to apply resources to create or change the cluster.
ConditionTypeApplyResources = "ApplyResources"

// ConditionTypeReplicasReady all pods of components are ready.
ConditionTypeReplicasReady = "ReplicasReady"

// ConditionTypeReady all components are running.
ConditionTypeReady = "Ready"

// ConditionTypeAvailable indicates whether the target object is available for serving.
ConditionTypeAvailable = "Available"
)

type ServiceRef struct {
Expand Down
5 changes: 5 additions & 0 deletions apis/apps/v1/zz_generated.deepcopy.go

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

6 changes: 3 additions & 3 deletions config/crd/bases/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15937,13 +15937,13 @@ spec:
description: Specifies the current state of the Component.
enum:
- Creating
- Running
- Updating
- Stopping
- Stopped
- Starting
- Deleting
- Running
- Stopped
- Failed
- Abnormal
type: string
type: object
description: Records the current status information of all Components
Expand Down
Loading
Loading