-
Notifications
You must be signed in to change notification settings - Fork 39
fix terminal addons #166
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
base: main
Are you sure you want to change the base?
fix terminal addons #166
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,8 +52,6 @@ var ( | |
var ( | ||
// TerminalStatuses defines the list of statuses that are terminal for an addon | ||
TerminalStatuses = []string{ | ||
StatusCreateFailed, | ||
StatusUpdateFailed, | ||
StatusDeleteFailed, | ||
// Still not sure if we should consider DEGRADED as terminal | ||
// StatusDegraded, | ||
|
@@ -101,6 +99,16 @@ func addonHasTerminalStatus(r *resource) bool { | |
return false | ||
} | ||
|
||
// addonInFailedState returns true if the supplied addon is in a failed state | ||
// that requires retry (CREATE_FAILED or UPDATE_FAILED) | ||
func addonInFailedState(r *resource) bool { | ||
if r.ko.Status.Status == nil { | ||
return false | ||
} | ||
cs := *r.ko.Status.Status | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
return cs == StatusCreateFailed || cs == StatusUpdateFailed | ||
} | ||
|
||
// requeueWaitUntilCanModify returns a `ackrequeue.RequeueNeededAfter` struct | ||
// explaining the addon cannot be modified until it reaches an active status. | ||
func requeueWaitUntilCanModify(r *resource) *ackrequeue.RequeueNeededAfter { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably do the |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,11 @@ | |
ackcondition.SetSynced(latest, corev1.ConditionFalse, &msg, nil) | ||
return latest, requeueWaitWhileDeleting | ||
} | ||
if !addonActive(latest) { | ||
|
||
// Check if addon is in a failed state that requires retry | ||
inFailedState := addonInFailedState(latest) | ||
|
||
if !addonActive(latest) && !inFailedState { | ||
msg := "Addon is in '" + *latest.ko.Status.Status + "' status" | ||
ackcondition.SetSynced(latest, corev1.ConditionFalse, &msg, nil) | ||
if addonHasTerminalStatus(latest) { | ||
|
@@ -13,16 +17,24 @@ | |
return latest, requeueWaitUntilCanModify(latest) | ||
} | ||
|
||
// If addon is in failed state, we need to force an update regardless of delta | ||
if inFailedState { | ||
msg := "Addon is in '" + *latest.ko.Status.Status + "' status, attempting recovery" | ||
ackcondition.SetSynced(latest, corev1.ConditionFalse, &msg, nil) | ||
} | ||
Comment on lines
+20
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can add this one in sdkFind as well |
||
|
||
if delta.DifferentAt("Spec.Tags") { | ||
err := syncTags( | ||
ctx, rm.sdkapi, rm.metrics, | ||
string(*desired.ko.Status.ACKResourceMetadata.ARN), | ||
ctx, rm.sdkapi, rm.metrics, | ||
string(*desired.ko.Status.ACKResourceMetadata.ARN), | ||
aws.ToStringMap(desired.ko.Spec.Tags), aws.ToStringMap(latest.ko.Spec.Tags), | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
if !delta.DifferentExcept("Spec.Tags"){ | ||
return desired, nil | ||
} | ||
// If addon is in failed state, always attempt update to recover | ||
// Otherwise, check if there are differences to update | ||
if !inFailedState && !delta.DifferentExcept("Spec.Tags") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we probably won't need |
||
return desired, nil | ||
} |
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.
nit: