Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid duplicated irreconcilable status #226

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kovayur
Copy link

@kovayur kovayur commented Jul 31, 2023

Fixes pt. 1 in #224

When install or upgrade fails irreconcilable status is set 2 times, this always lead to a CR update and a new reconciliation cycle.

Copy link
Member

@porridge porridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When install or upgrade fails irreconcilable status is set 2 times

Maybe I'm just confused, but AFAICT this change is not really changing this fact. I think multiple u.UpdateStatus(updater.EnsureCondition(conditions.Irreconcilable(...))) calls are coalesced, so still end up as at most single API UPDATE call. So I don't understand where this 2 times is coming from? Can you please explain this case in more detail?

Adding the new UpdateStatus call in the default case definitely looks right.

However I don't think line 628 did any harm (though it might have been superfluous as long as all of the do* methods also set the irreconcilable condition).

@@ -651,7 +650,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.
return ctrl.Result{}, err
}
default:
return ctrl.Result{}, fmt.Errorf("unexpected release state: %s", state)
err := fmt.Errorf("unexpected release state: %s", state)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is in scope, but I just realized the inconsistency of whether we set or redefine err (err := rather than err =) here, in the preceding case as well as in the prehook loop might have unintended consequences, given that it affects the defer block for the updater Apply call.

I wonder whether we should take a closer look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants