@@ -528,12 +528,10 @@ func (d *namespacedResourcesDeleter) deleteAllContent(ctx context.Context, ns *v
528
528
gvrToNumRemaining : map [schema.GroupVersionResource ]int {},
529
529
finalizersToNumRemaining : map [string ]int {},
530
530
}
531
+ podsGVR := schema.GroupVersionResource {Group : "" , Version : "v1" , Resource : "pods" }
531
532
532
- if utilfeature .DefaultFeatureGate .Enabled (features .OrderedNamespaceDeletion ) {
533
- // TODO: remove this log when the feature gate is enabled by default
534
- logger .V (5 ).Info ("Namespace controller - OrderedNamespaceDeletion feature gate is enabled" , "namespace" , namespace )
533
+ if _ , hasPods := groupVersionResources [podsGVR ]; hasPods && utilfeature .DefaultFeatureGate .Enabled (features .OrderedNamespaceDeletion ) {
535
534
// Ensure all pods in the namespace are deleted first
536
- podsGVR := schema.GroupVersionResource {Group : "" , Version : "v1" , Resource : "pods" }
537
535
gvrDeletionMetadata , err := d .deleteAllContentForGroupVersionResource (ctx , podsGVR , namespace , namespaceDeletedAt )
538
536
if err != nil {
539
537
errs = append (errs , fmt .Errorf ("failed to delete pods for namespace: %s, err: %w" , namespace , err ))
@@ -561,6 +559,10 @@ func (d *namespacedResourcesDeleter) deleteAllContent(ctx context.Context, ns *v
561
559
562
560
// Proceed with deleting other resources in the namespace
563
561
for gvr := range groupVersionResources {
562
+ if utilfeature .DefaultFeatureGate .Enabled (features .OrderedNamespaceDeletion ) && gvr .Group == podsGVR .Group &&
563
+ gvr .Version == podsGVR .Version && gvr .Resource == podsGVR .Resource {
564
+ continue
565
+ }
564
566
gvrDeletionMetadata , err := d .deleteAllContentForGroupVersionResource (ctx , gvr , namespace , namespaceDeletedAt )
565
567
if err != nil {
566
568
// If there is an error, hold on to it but proceed with all the remaining
0 commit comments