Skip to content

Commit

Permalink
Merge pull request #227 from shafeeqes/enh/fd
Browse files Browse the repository at this point in the history
Don't wait for MR to get deleted in case of force-delete
  • Loading branch information
axel7born authored Nov 2, 2023
2 parents b072476 + fdfa1a4 commit 2528149
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions pkg/controller/actuator_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

extensionscontroller "github.com/gardener/gardener/extensions/pkg/controller"
extensionswebhookshoot "github.com/gardener/gardener/extensions/pkg/webhook/shoot"
v1beta1helper "github.com/gardener/gardener/pkg/apis/core/v1beta1/helper"
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
"github.com/gardener/gardener/pkg/utils/managedresources"
"github.com/go-logr/logr"
Expand Down Expand Up @@ -51,16 +52,22 @@ func (a *actuator) Delete(ctx context.Context, _ logr.Logger, network *extension
return fmt.Errorf("could not delete managed resource containing shoot webhook '%s': %w", ShootWebhooksResourceName, err)
}

timeoutCtx4, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
if err := managedresources.WaitUntilDeleted(timeoutCtx4, a.client, network.Namespace, ShootWebhooksResourceName); err != nil {
return fmt.Errorf("error while waiting for managed resource containing shoot webhook '%s' to be deleted: %w", ShootWebhooksResourceName, err)
if cluster != nil && !v1beta1helper.ShootNeedsForceDeletion(cluster.Shoot) {
timeoutCtx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
if err := managedresources.WaitUntilDeleted(timeoutCtx, a.client, network.Namespace, ShootWebhooksResourceName); err != nil {
return fmt.Errorf("error while waiting for managed resource containing shoot webhook '%s' to be deleted: %w", ShootWebhooksResourceName, err)
}
}
}

timeoutCtx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
return managedresources.WaitUntilDeleted(timeoutCtx, a.client, network.Namespace, CiliumConfigManagedResourceName)
if cluster != nil && !v1beta1helper.ShootNeedsForceDeletion(cluster.Shoot) {
timeoutCtx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
return managedresources.WaitUntilDeleted(timeoutCtx, a.client, network.Namespace, CiliumConfigManagedResourceName)
}

return nil
}

// ForceDelete implements Network.Actuator.
Expand Down

0 comments on commit 2528149

Please sign in to comment.