Skip to content

Commit cf05d91

Browse files
committed
feat: move h-scale lifecycle into instanceset
1 parent edbff89 commit cf05d91

20 files changed

Lines changed: 6300 additions & 12 deletions

apis/workloads/v1/instanceset_types.go

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,23 @@ type LifecycleActions struct {
524524
// +optional
525525
Switchover *Action `json:"switchover,omitempty"`
526526

527+
// Defines the procedure to add a new replica into membership.
528+
//
529+
// +optional
530+
MemberJoin *Action `json:"memberJoin,omitempty"`
531+
532+
// Defines the procedure to remove a replica from membership.
533+
//
534+
// +optional
535+
MemberLeave *Action `json:"memberLeave,omitempty"`
536+
537+
// Defines the procedure for importing data into a replica.
538+
// InstanceSet only orchestrates the target replica side of this action.
539+
// Any source selection, dump, or streaming protocol remains the responsibility of the action implementation itself.
540+
//
541+
// +optional
542+
DataLoad *Action `json:"dataLoad,omitempty"`
543+
527544
// Defines the procedure that update replicas with new configuration.
528545
//
529546
// +optional
@@ -579,6 +596,21 @@ type InstanceStatus struct {
579596
// +optional
580597
Configs []InstanceConfigStatus `json:"configs,omitempty"`
581598

599+
// Represents whether the instance is provisioned.
600+
//
601+
// +optional
602+
Provisioned bool `json:"provisioned,omitempty"`
603+
604+
// Represents whether the instance data is loaded.
605+
//
606+
// +optional
607+
DataLoaded *bool `json:"dataLoaded,omitempty"`
608+
609+
// Represents whether the instance has joined the cluster membership.
610+
//
611+
// +optional
612+
MemberJoined *bool `json:"memberJoined,omitempty"`
613+
582614
// Represents whether the instance is in volume expansion.
583615
//
584616
// +optional
@@ -703,7 +735,7 @@ func (r *InstanceSet) IsInstanceSetReady() bool {
703735
if !instancesReady {
704736
return false
705737
}
706-
return r.IsRoleProbeDone()
738+
return r.IsRoleProbeDone() && r.IsLifecycleReady()
707739
}
708740

709741
func (r *InstanceSet) IsRoleProbeDone() bool {
@@ -719,3 +751,15 @@ func (r *InstanceSet) IsRoleProbeDone() bool {
719751
}
720752
return cnt == replicas
721753
}
754+
755+
func (r *InstanceSet) IsLifecycleReady() bool {
756+
for _, inst := range r.Status.InstanceStatus {
757+
if inst.DataLoaded != nil && !*inst.DataLoaded {
758+
return false
759+
}
760+
if inst.MemberJoined != nil && !*inst.MemberJoined {
761+
return false
762+
}
763+
}
764+
return true
765+
}

apis/workloads/v1/zz_generated.deepcopy.go

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

config/crd/bases/workloads.kubeblocks.io_instances.yaml

Lines changed: 1299 additions & 0 deletions
Large diffs are not rendered by default.

config/crd/bases/workloads.kubeblocks.io_instancesets.yaml

Lines changed: 1309 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)