Skip to content

Commit 3511661

Browse files
committed
Initial implementation for the reconcile logic
Signed-off-by: Gaurav Dasson <[email protected]>
1 parent aee49b1 commit 3511661

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

internal/controller/etcdcluster_controller.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,24 @@ func (r *EtcdClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
188188
targetReplica := *sts.Spec.Replicas // Start with the current size of the stateful set
189189
eps := clientEndpointsFromStatefulsets(sts)
190190

191+
// TODO: finish the logic later
192+
if int(targetReplica) != memberCnt {
193+
// TODO: finish the logic later
194+
if int(targetReplica) < memberCnt {
195+
// a new added learner hasn't started yet
196+
197+
// re-generate configuration for the new learner member;
198+
// increase statefulsets's replica by 1
199+
} else {
200+
// an already removed member hasn't stopped yet.
201+
202+
// Decrease the statefulsets's replica by 1
203+
}
204+
// return
205+
}
206+
191207
// Check if the size of the stateful set is less than expected size
192-
if targetReplica < int32(etcdCluster.Spec.Size) && memberCnt > 0 {
208+
if targetReplica < int32(etcdCluster.Spec.Size) {
193209
// If there is no more learner, then we can proceed to scale the cluster further.
194210
// If there is no more member to add, the control will not reach here after the requeue
195211

0 commit comments

Comments
 (0)