Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/condition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,21 @@ func WithTerminalCondition(
return ko
}

// WithRecoverableCondition returns a new AWSResource with the
// ConditionTypeRecoverable set based on the err parameter
func WithRecoverableCondition(
resource acktypes.AWSResource,
err error,
) acktypes.AWSResource {
ko := resource.DeepCopy()

if err != nil {
errString := err.Error()
SetRecoverable(ko, corev1.ConditionTrue, &errString, nil)
}
return ko
}

// LateInitializationInProgress return true if ConditionTypeLateInitialized has "False" status
// False status means that resource has LateInitializationConfig but has not been completely
// late initialized yet.
Expand Down
4 changes: 2 additions & 2 deletions pkg/runtime/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,10 @@ func (r *resourceReconciler) Sync(
return latest, err
}
if adoptionPolicy == AdoptionPolicy_Adopt || isAdopted {
return nil, ackerr.AdoptedResourceNotFound
return ackcondition.WithRecoverableCondition(desired, ackerr.AdoptedResourceNotFound), ackerr.AdoptedResourceNotFound
}
if isReadOnly {
return nil, ackerr.ReadOnlyResourceNotFound
return ackcondition.WithRecoverableCondition(desired, ackerr.ReadOnlyResourceNotFound), ackerr.ReadOnlyResourceNotFound
}
if latest, err = r.createResource(ctx, rm, resolved); err != nil {
return latest, err
Expand Down