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 Oct 10, 2023
1 parent ab54082 commit 4156f61
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 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,20 @@ 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
return true
}
// 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
return true
}
// Already in powering off state. Allow state machine to run.
return false
}
Expand Down

0 comments on commit 4156f61

Please sign in to comment.