Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into kim-update-shoot
Browse files Browse the repository at this point in the history
  • Loading branch information
koala7659 committed Jul 9, 2024
2 parents f77d05d + fe7524c commit c029918
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions internal/controller/runtime/fsm/runtime_fsm_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ func requeue() (stateFn, *ctrl.Result, error) {
return nil, &ctrl.Result{Requeue: true}, nil
}

func requeueAfter(d time.Duration) (stateFn, *ctrl.Result, error) {
return nil, &ctrl.Result{RequeueAfter: d}, nil
}

func stop() (stateFn, *ctrl.Result, error) {
return nil, nil, nil
}
Expand Down
17 changes: 13 additions & 4 deletions internal/controller/runtime/fsm/runtime_fsm_initialise.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,24 @@ func sFnInitialize(ctx context.Context, m *fsm, s *systemState) (stateFn, *ctrl.
return switchState(sFnSelectShootProcessing)
}

shootInOrAfterDeleting := s.shoot == nil || !s.shoot.GetDeletionTimestamp().IsZero()
// resource cleanup is done;
// instance is being deleted and shoot was already deleted
if !instanceIsNotBeingDeleted && instanceHasFinalizer && s.shoot == nil {
return removeFinalizerAndStop(ctx, m, s)
}

if !instanceIsNotBeingDeleted && instanceHasFinalizer && !shootInOrAfterDeleting {
// resource cleanup did not start;
// instance is being deleted and shoot is not being deleted
if !instanceIsNotBeingDeleted && instanceHasFinalizer && s.shoot.DeletionTimestamp.IsZero() {
m.log.Info("Delete instance resources")
return switchState(sFnDeleteShoot)
}

if !instanceIsNotBeingDeleted && instanceHasFinalizer && shootInOrAfterDeleting {
return removeFinalizerAndStop(ctx, m, s)
// resource cleanup in progress;
// instance is being deleted and shoot is being deleted
if !instanceIsNotBeingDeleted && instanceHasFinalizer {
m.log.Info("Waiting on instance resources being deleted")
return requeueAfter(gardenerRequeueDuration)
}

m.log.Info("noting to reconcile, stopping sfm")
Expand Down

0 comments on commit c029918

Please sign in to comment.