Skip to content

Commit

Permalink
Merge pull request #338 from stuggi/fix_RequeueAfter
Browse files Browse the repository at this point in the history
Return nil error in case NotFound and to use RequeueAfter
  • Loading branch information
openshift-merge-bot[bot] committed Aug 7, 2024
2 parents 65f8da3 + 607532c commit ffb0a6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion controllers/ovncontroller_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,14 @@ func (r *OVNControllerReconciler) reconcileNormal(ctx context.Context, instance
_, err = nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
if err != nil {
if k8s_errors.IsNotFound(err) {
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
instance.Status.Conditions.Set(condition.FalseCondition(
condition.NetworkAttachmentsReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.NetworkAttachmentsReadyWaitingMessage,
netAtt))
return ctrl.Result{RequeueAfter: time.Second * 10}, fmt.Errorf("network-attachment-definition %s not found", netAtt)
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.NetworkAttachmentsReadyCondition,
Expand Down
7 changes: 4 additions & 3 deletions controllers/ovndbcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,14 @@ func (r *OVNDBClusterReconciler) reconcileNormal(ctx context.Context, instance *
_, err := nad.GetNADWithName(ctx, helper, instance.Spec.NetworkAttachment, instance.Namespace)
if err != nil {
if k8s_errors.IsNotFound(err) {
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", instance.Spec.NetworkAttachment))
instance.Status.Conditions.Set(condition.FalseCondition(
condition.NetworkAttachmentsReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.NetworkAttachmentsReadyWaitingMessage,
instance.Spec.NetworkAttachment))
return ctrl.Result{RequeueAfter: time.Second * 10}, fmt.Errorf("network-attachment-definition %s not found", instance.Spec.NetworkAttachment)
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.NetworkAttachmentsReadyCondition,
Expand Down Expand Up @@ -758,8 +759,8 @@ func (r *OVNDBClusterReconciler) reconcileServices(
// Returning here instead of at the beggining of the for is done to
// expose the already created pods to other services/dataplane nodes
if len(podList.Items) < int(*(instance.Spec.Replicas)) {
err = fmt.Errorf("not all pods are yet created, number of expected pods: %v, current pods: %v", *(instance.Spec.Replicas), len(podList.Items))
return ctrl.Result{RequeueAfter: 1 * time.Second}, err
Log.Info(fmt.Sprintf("not all pods are yet created, number of expected pods: %v, current pods: %v", *(instance.Spec.Replicas), len(podList.Items)))
return ctrl.Result{RequeueAfter: 1 * time.Second}, nil
}
}
// dbAddress will contain ovsdbserver-(nb|sb).openstack.svc or empty
Expand Down

0 comments on commit ffb0a6f

Please sign in to comment.