-
Notifications
You must be signed in to change notification settings - Fork 104
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
Explicitly cover only specific plan status for cleanup plans #1358
Conversation
This ensure that cleanup plans aren't (re-)started after a fatal error. Signed-off-by: Jan Schlicht <jan@d2iq.com>
return plan, nil | ||
case kudov1beta1.ExecutionComplete: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens in the case of ExecutionFatalError
?
We should probably check for planStatus.isTerminal
, i guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked at the surrounding code. I think the if i.isDeleting() {
block should always return, at the moment it falls through to i.GetPlanInProgress() != nil {
etc. This might lead to the correct result, but it's not really clear from the code what actually should happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
if i.isDeleting() {
block should always return, at the moment it falls through toi.GetPlanInProgress() != nil {
the i.GetPlanInProgress
is outside of the i.isDeleting
block. The problem here is/was that if !planStatus.Status.IsRunning()
on the left side also covers the ExecutionFatalError
case, where the plan
is returned here and then reseted/restarted in the caller (we obviously don't want to infinitely restart plans in FATAL_ERROR
status).
I'm reworking this part of logic as part of my PR so I would go for a bigger refactoring here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the left side is certainly not correct. I'm just noted that the new code does not clearly states what happens in case of a ExecutionFatalError
. If we add an additional
case kudov1beta1.ExecutionFatalError:
// Don't restart in case of a fatal error
return nil, nil
it would feel a lot more clear to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is implicitly covered by the subsequent i.GetPlanInProgress()
check and thus redundant but I don't mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see it changed, but it's not really a requirement for me, so approving for now.
return nil, nil | ||
} | ||
switch planStatus.Status { | ||
case kudov1beta1.ExecutionNeverRun: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this would be ok, as the the cleanup plan is only ran on the deletion of the instance CR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
return plan, nil | ||
case kudov1beta1.ExecutionComplete: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
if i.isDeleting() {
block should always return, at the moment it falls through toi.GetPlanInProgress() != nil {
the i.GetPlanInProgress
is outside of the i.isDeleting
block. The problem here is/was that if !planStatus.Status.IsRunning()
on the left side also covers the ExecutionFatalError
case, where the plan
is returned here and then reseted/restarted in the caller (we obviously don't want to infinitely restart plans in FATAL_ERROR
status).
I'm reworking this part of logic as part of my PR so I would go for a bigger refactoring here.
This ensure that cleanup plans aren't (re-)started after a fatal error. Signed-off-by: Jan Schlicht <jan@d2iq.com> Signed-off-by: Thomas Runyon <runyontr@gmail.com>
What this PR does / why we need it:
This ensure that cleanup plans aren't (re-)started after a fatal error.
Fixes #1357