Skip to content

Commit 793c13f

Browse files
authored
Fix failed instances from preventing deletion (#42)
- If instances were in a "failed" state during a deletion finalization, capox would keep waiting until they get out of a failed state. We can just delete failed instances.
1 parent f8c6fd6 commit 793c13f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/controller/oxidemachine_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ func (r *OxideMachineReconciler) ensureInstanceDeleted(
389389

390390
// Instance deletion state machine:
391391
// * If running, stop and requeue.
392-
// * If stopped, destroy and requeue.
392+
// * If stopped or failed, destroy and requeue.
393393
// * Else log and requeue.
394394
switch instance.RunState {
395395
case oxide.InstanceStateRunning:
@@ -402,7 +402,7 @@ func (r *OxideMachineReconciler) ensureInstanceDeleted(
402402
return false, instance, fmt.Errorf("stopping instance: %w", err)
403403
}
404404
return false, instance, nil
405-
case oxide.InstanceStateStopped:
405+
case oxide.InstanceStateStopped, oxide.InstanceStateFailed:
406406
log.Info("destroying instance", "instance", instance.Id)
407407
if err := oxideClient.InstanceDelete(ctx, oxide.InstanceDeleteParams{
408408
Project: oxide.NameOrId(projectName),

0 commit comments

Comments
 (0)