Skip to content

Commit

Permalink
Merge pull request #297 from gthiemonge/fix-conditions
Browse files Browse the repository at this point in the history
Remove duplicate defer function
  • Loading branch information
openshift-merge-bot[bot] authored Apr 24, 2024
2 parents ab112a2 + 8a07e0f commit 6611fa1
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions controllers/amphoracontroller_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,29 +187,6 @@ func (r *OctaviaAmphoraControllerReconciler) Reconcile(ctx context.Context, req
instance.Status.NetworkAttachments = map[string][]string{}
}

// Always patch the instance status when exiting this function so we can persist any changes.
defer func() {
// update the overall status condition if service is ready
if instance.IsReady() {
instance.Status.Conditions.MarkTrue(condition.ReadyCondition, condition.ReadyMessage)
} else {
instance.Status.Conditions.MarkUnknown(condition.ReadyCondition, condition.InitReason, condition.ReadyInitMessage)
instance.Status.Conditions.Set(instance.Status.Conditions.Mirror(condition.ReadyCondition))
}

if err := helper.SetAfter(instance); err != nil {
Log.Error(err, "Set after and calc patch/diff")
}

if changed := helper.GetChanges()["status"]; changed {
patch := client.MergeFrom(helper.GetBeforeObject())

if err := r.Status().Patch(ctx, instance, patch); err != nil && !k8s_errors.IsNotFound(err) {
Log.Error(err, "Update status")
}
}
}()

// Handle non-deleted clusters
return r.reconcileNormal(ctx, instance, helper)
}
Expand Down

0 comments on commit 6611fa1

Please sign in to comment.