Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#357 from stuggi/fix_Requeu…
Browse files Browse the repository at this point in the history
…eAfter

Return nil error in case NotFound and to use RequeueAfter
  • Loading branch information
openshift-merge-bot[bot] authored Aug 7, 2024
2 parents 47a11ff + 23ea27a commit b73449a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/horizon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,13 @@ func (r *HorizonReconciler) reconcileNormal(ctx context.Context, instance *horiz
ospSecret, hash, err := oko_secret.GetSecret(ctx, helper, instance.Spec.Secret, instance.Namespace)
if err != nil {
if k8s_errors.IsNotFound(err) {
Log.Info(fmt.Sprintf("openstack secret %s not found", instance.Spec.Secret))
instance.Status.Conditions.Set(condition.FalseCondition(
condition.InputReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.InputReadyWaitingMessage))
return ctrl.Result{RequeueAfter: time.Second * 10}, fmt.Errorf("openstack secret %s not found", instance.Spec.Secret)
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.InputReadyCondition,
Expand All @@ -527,12 +528,13 @@ func (r *HorizonReconciler) reconcileNormal(ctx context.Context, instance *horiz
memcached, err := memcachedv1.GetMemcachedByName(ctx, helper, instance.Spec.MemcachedInstance, instance.Namespace)
if err != nil {
if k8s_errors.IsNotFound(err) {
Log.Info(fmt.Sprintf("memcached %s not found", instance.Spec.MemcachedInstance))
instance.Status.Conditions.Set(condition.FalseCondition(
condition.MemcachedReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.MemcachedReadyWaitingMessage))
return ctrl.Result{RequeueAfter: time.Second * 10}, fmt.Errorf("memcached %s not found", instance.Spec.MemcachedInstance)
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.MemcachedReadyCondition,
Expand All @@ -544,12 +546,13 @@ func (r *HorizonReconciler) reconcileNormal(ctx context.Context, instance *horiz
}

if !memcached.IsReady() {
Log.Info(fmt.Sprintf("memcached %s is not ready", memcached.Name))
instance.Status.Conditions.Set(condition.FalseCondition(
condition.MemcachedReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.MemcachedReadyWaitingMessage))
return ctrl.Result{RequeueAfter: time.Second * 10}, fmt.Errorf("memcached %s is not ready", memcached.Name)
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}
// Mark the Memcached Service as Ready if we get to this point with no errors
instance.Status.Conditions.MarkTrue(
Expand Down

0 comments on commit b73449a

Please sign in to comment.