Skip to content

Commit

Permalink
Bug 2007802: do not requeue if the machine has been updated
Browse files Browse the repository at this point in the history
Commit [1] accidentaly removed the check to ensure that the machine
hasn't been updated before requeueing. It causes a problem with
situations when the machine's vm has been removed, but the machine
object's still available.

In this case starts requeueing the machine in an infinite loop,
preventing it to be deleted or updated.

To fix it, this commit returns the additional checks.

[1] 85f1753
  • Loading branch information
Fedosin committed Oct 13, 2021
1 parent 9eb5cae commit c971ae6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/actuators/machine/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (r *Reconciler) update() error {

existingLen := len(existingInstances)
if existingLen == 0 {
if r.machine.Spec.ProviderID != nil && *r.machine.Spec.ProviderID != "" && len(r.machine.Status.Addresses) == 0 {
if r.machine.Spec.ProviderID != nil && *r.machine.Spec.ProviderID != "" && len(r.machine.Status.Addresses) == 0 && (r.machine.Status.LastUpdated == nil || r.machine.Status.LastUpdated.Add(requeueAfterSeconds*time.Second).After(time.Now())) {
klog.Infof("%s: Possible eventual-consistency discrepancy; returning an error to requeue", r.machine.Name)
return &machinecontroller.RequeueAfterError{RequeueAfter: requeueAfterSeconds * time.Second}
}
Expand Down Expand Up @@ -257,7 +257,7 @@ func (r *Reconciler) exists() (bool, error) {
}

if len(existingInstances) == 0 {
if r.machine.Spec.ProviderID != nil && *r.machine.Spec.ProviderID != "" && len(r.machine.Status.Addresses) == 0 {
if r.machine.Spec.ProviderID != nil && *r.machine.Spec.ProviderID != "" && len(r.machine.Status.Addresses) == 0 && (r.machine.Status.LastUpdated == nil || r.machine.Status.LastUpdated.Add(requeueAfterSeconds*time.Second).After(time.Now())) {
klog.Infof("%s: Possible eventual-consistency discrepancy; returning an error to requeue", r.machine.Name)
return false, &machinecontroller.RequeueAfterError{RequeueAfter: requeueAfterSeconds * time.Second}
}
Expand Down

0 comments on commit c971ae6

Please sign in to comment.