Skip to content

Commit

Permalink
fix: skip-reconcile annotation still skipping reconcile even the valu…
Browse files Browse the repository at this point in the history
…e is false (#1202)

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
  • Loading branch information
husnialhamdani authored Jan 13, 2025
1 parent e7e6688 commit b00f1df
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/redis/redis_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
}
return intctrlutil.Reconciled()
}
if _, found := instance.ObjectMeta.GetAnnotations()["redis.opstreelabs.in/skip-reconcile"]; found {
if value, found := instance.ObjectMeta.GetAnnotations()["redis.opstreelabs.in/skip-reconcile"]; found && value == "true" {
return intctrlutil.RequeueAfter(ctx, time.Second*10, "found skip reconcile annotation")
}
if err = k8sutils.AddFinalizer(ctx, instance, k8sutils.RedisFinalizer, r.Client); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/rediscluster/rediscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
}
return intctrlutil.Reconciled()
}
if _, found := instance.ObjectMeta.GetAnnotations()["rediscluster.opstreelabs.in/skip-reconcile"]; found {
if value, found := instance.ObjectMeta.GetAnnotations()["rediscluster.opstreelabs.in/skip-reconcile"]; found && value == "true" {
log.FromContext(ctx).Info("found skip reconcile annotation", "namespace", instance.Namespace, "name", instance.Name)
return intctrlutil.RequeueAfter(ctx, time.Second*10, "found skip reconcile annotation")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (r *Reconciler) reconcileFinalizer(ctx context.Context, instance *redisv1be
}

func (r *Reconciler) reconcileAnnotation(ctx context.Context, instance *redisv1beta2.RedisReplication) (ctrl.Result, error) {
if _, found := instance.ObjectMeta.GetAnnotations()["redisreplication.opstreelabs.in/skip-reconcile"]; found {
if value, found := instance.ObjectMeta.GetAnnotations()["redisreplication.opstreelabs.in/skip-reconcile"]; found && value == "true" {
log.FromContext(ctx).Info("found skip reconcile annotation", "namespace", instance.Namespace, "name", instance.Name)
return intctrlutil.RequeueAfter(ctx, time.Second*10, "found skip reconcile annotation")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/redissentinel/redissentinel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (r *RedisSentinelReconciler) reconcileFinalizer(ctx context.Context, instan
}

func (r *RedisSentinelReconciler) reconcileAnnotation(ctx context.Context, instance *redisv1beta2.RedisSentinel) (ctrl.Result, error) {
if _, found := instance.ObjectMeta.GetAnnotations()["redissentinel.opstreelabs.in/skip-reconcile"]; found {
if value, found := instance.ObjectMeta.GetAnnotations()["redissentinel.opstreelabs.in/skip-reconcile"]; found && value == "true" {
log.FromContext(ctx).Info("found skip reconcile annotation", "namespace", instance.Namespace, "name", instance.Name)
return intctrlutil.RequeueAfter(ctx, time.Second*10, "found skip reconcile annotation")
}
Expand Down

0 comments on commit b00f1df

Please sign in to comment.