Skip to content

Commit

Permalink
pkg/daemon/update.go: check wait err and wrap it
Browse files Browse the repository at this point in the history
we missed checking it https://github.com/openshift/machine-config-operator/blob/master/pkg/daemon/update.go#L92

Signed-off-by: Antonio Murdaca <runcom@linux.com>
  • Loading branch information
runcom committed Feb 13, 2019
1 parent 6dd0d38 commit 87b6c2d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,25 @@ func (dn *Daemon) updateOSAndReboot(newConfig *mcfgv1.MachineConfig) error {
Factor: 2,
}
var lastErr error
wait.ExponentialBackoff(backoff, func() (bool, error) {
if err := wait.ExponentialBackoff(backoff, func() (bool, error) {
err := drain.Drain(dn.kubeClient, []*corev1.Node{node}, &drain.DrainOptions{
DeleteLocalData: true,
Force: true,
GracePeriodSeconds: 600,
IgnoreDaemonsets: true,
})
if err != nil {
glog.Infof("Draining failed with: %v; retrying...", err)
lastErr = err
return false, nil
if err == nil {
return true, nil
}
lastErr = err
glog.Infof("Draining failed with: %v, retrying", err)
return false, nil

}); err != nil {
if err == wait.ErrWaitTimeout {
return errors.Wrapf(lastErr, "failed to drain node (%d tries): %v", backoff.Steps, err)
}
lastErr = nil
return true, nil
})
if lastErr != nil {
return errors.Wrapf(lastErr, "Failed to drain node (%d tries)", backoff.Steps)
return errors.Wrap(err, "failed to drain node")
}
glog.V(2).Info("Node successfully drained")
}
Expand Down

0 comments on commit 87b6c2d

Please sign in to comment.