Skip to content

Commit

Permalink
Skip to delete if registration errors pile up
Browse files Browse the repository at this point in the history
  • Loading branch information
honza committed Sep 18, 2023
1 parent 111f553 commit 2fcf433
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/metal3.io/host_state_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,18 @@ func (hsm *hostStateMachine) checkInitiateDelete(log logr.Logger) bool {
hsm.NextState = metal3api.StateDeprovisioning
}
case metal3api.StateDeprovisioning:
if hsm.Host.Status.ErrorType == metal3api.RegistrationError && hsm.Host.Status.ErrorCount > 3 {
hsm.NextState = metal3api.StateDeleting
}
// Allow state machine to run to continue deprovisioning.
return false
case metal3api.StateDeleting:
// Already in deleting state. Allow state machine to run.
return false
case metal3api.StatePoweringOffBeforeDelete:
if hsm.Host.Status.ErrorType == metal3api.RegistrationError && hsm.Host.Status.ErrorCount > 3 {
hsm.NextState = metal3api.StateDeleting
}
// Already in powering off state. Allow state machine to run.
return false
}
Expand Down

0 comments on commit 2fcf433

Please sign in to comment.