Skip to content

Commit

Permalink
Revert chaos when error during drain for node-drain experiments (#668)
Browse files Browse the repository at this point in the history
- Added an call to uncordonNode in case of an error of the drainNode function

Signed-off-by: Calvin Audier <[email protected]>
  • Loading branch information
Calvinaud committed Sep 21, 2023
1 parent 392ea29 commit b710216
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chaoslib/litmus/node-drain/lib/node-drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ func PrepareNodeDrain(experimentsDetails *experimentTypes.ExperimentDetails, cli

// Drain the application node
if err := drainNode(experimentsDetails, clients, chaosDetails); err != nil {
log.Info("[Revert]: Reverting chaos because error during draining of node")
if uncordonErr := uncordonNode(experimentsDetails, clients, chaosDetails); uncordonErr != nil {
return cerrors.PreserveError{ErrString: fmt.Sprintf("[%s,%s]", stacktrace.RootCause(err).Error(), stacktrace.RootCause(uncordonErr).Error())}
}
return stacktrace.Propagate(err, "could not drain node")
}

Expand Down

0 comments on commit b710216

Please sign in to comment.