Skip to content

Commit

Permalink
Merge pull request #291 from m00g3n/delete-rt-wait-on-shoot-delete
Browse files Browse the repository at this point in the history
Change delete Runtime CR to wait on Shoot CR delete
  • Loading branch information
kyma-bot authored Jul 9, 2024
2 parents 2ea9b23 + de5eb82 commit fe7524c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -758,14 +758,19 @@ spec:
>= v1.26.'
type: string
systemReserved:
description: SystemReserved is the configuration
description: 'SystemReserved is the configuration
for resources reserved for system processes
not managed by kubernetes (e.g. journald).
When updating these values, be aware that
cgroup resizes may not succeed on active worker
nodes. Look for the NodeAllocatableEnforced
event to determine if the configuration was
applied.
applied. Deprecated: Separately configuring
resource reservations for system processes
is deprecated in Gardener and will be removed
soon. Please merge existing resource reservations
into the kubeReserved field. TODO(MichaelEischer):
Drop this field after v1.113 has been released.'
properties:
cpu:
anyOf:
Expand Down
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(sFnPrepareCluster) // wait for pending shoot operation to complete
}

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 fe7524c

Please sign in to comment.