Skip to content

Commit

Permalink
fix: check redis replication after handling finalizer (#936)
Browse files Browse the repository at this point in the history
Signed-off-by: drivebyer <yang.wu@daocloud.io>
  • Loading branch information
drivebyer authored May 21, 2024
1 parent fae7db7 commit bd1e4fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/redissentinel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ func (r *RedisSentinelReconciler) Reconcile(ctx context.Context, req ctrl.Reques
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}

if instance.Spec.RedisSentinelConfig != nil && !k8sutils.IsRedisReplicationReady(ctx, reqLogger, r.K8sClient, r.Dk8sClient, instance) {
reqLogger.Info("Redis Replication is specified but not ready, so will reconcile again in 10 seconds")
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}

// Get total Sentinel Replicas
// sentinelReplicas := instance.Spec.GetSentinelCounts("sentinel")

Expand All @@ -61,6 +56,11 @@ func (r *RedisSentinelReconciler) Reconcile(ctx context.Context, req ctrl.Reques
return ctrl.Result{RequeueAfter: time.Second * 60}, err
}

if instance.Spec.RedisSentinelConfig != nil && !k8sutils.IsRedisReplicationReady(ctx, reqLogger, r.K8sClient, r.Dk8sClient, instance) {
reqLogger.Info("Redis Replication is specified but not ready, so will reconcile again in 10 seconds")
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}

// Create Redis Sentinel
err = k8sutils.CreateRedisSentinel(ctx, r.K8sClient, r.Log, instance, r.K8sClient, r.Dk8sClient)
if err != nil {
Expand Down

0 comments on commit bd1e4fa

Please sign in to comment.