Skip to content

Commit

Permalink
Initial implementation for the reconcile logic
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Dasson <[email protected]>
  • Loading branch information
gdasson committed Jan 11, 2025
1 parent f8856f1 commit 6c46e88
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion internal/controller/etcdcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,24 @@ func (r *EtcdClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
targetReplica := *sts.Spec.Replicas // Start with the current size of the stateful set
eps := clientEndpointsFromStatefulsets(sts)

// TODO: finish the logic later
if int(targetReplica) != memberCnt {
// TODO: finish the logic later
if int(targetReplica) < memberCnt {
// a new added learner hasn't started yet

// re-generate configuration for the new learner member;
// increase statefulsets's replica by 1
} else {
// an already removed member hasn't stopped yet.

// Decrease the statefulsets's replica by 1
}
// return
}

// Check if the size of the stateful set is less than expected size
if targetReplica < int32(etcdCluster.Spec.Size) && memberCnt > 0 {
if targetReplica < int32(etcdCluster.Spec.Size) {
// If there is no more learner, then we can proceed to scale the cluster further.
// If there is no more member to add, the control will not reach here after the requeue

Expand Down

0 comments on commit 6c46e88

Please sign in to comment.