Skip to content

Commit 76b80b1

Browse files
authoredMar 4, 2025
Merge pull request kubernetes#130507 from cici37/updateFG
Update OrderedNamespaceDeletion feature gate on by default
2 parents dc1199a + 9598e5a commit 76b80b1

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed
 

‎pkg/controller/namespace/deletion/namespaced_resources_deleter.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,10 @@ func (d *namespacedResourcesDeleter) deleteAllContent(ctx context.Context, ns *v
528528
gvrToNumRemaining: map[schema.GroupVersionResource]int{},
529529
finalizersToNumRemaining: map[string]int{},
530530
}
531+
podsGVR := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
531532

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) {
535534
// Ensure all pods in the namespace are deleted first
536-
podsGVR := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
537535
gvrDeletionMetadata, err := d.deleteAllContentForGroupVersionResource(ctx, podsGVR, namespace, namespaceDeletedAt)
538536
if err != nil {
539537
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
561559

562560
// Proceed with deleting other resources in the namespace
563561
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+
}
564566
gvrDeletionMetadata, err := d.deleteAllContentForGroupVersionResource(ctx, gvr, namespace, namespaceDeletedAt)
565567
if err != nil {
566568
// If there is an error, hold on to it but proceed with all the remaining

‎pkg/features/versioned_kube_features.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
548548
},
549549

550550
OrderedNamespaceDeletion: {
551-
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha},
551+
{Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Beta},
552+
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta},
552553
},
553554

554555
PersistentVolumeLastPhaseTransitionTime: {

‎test/featuregates_linter/test_data/versioned_feature_list.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,11 @@
888888
versionedSpecs:
889889
- default: false
890890
lockToDefault: false
891-
preRelease: Alpha
891+
preRelease: Beta
892+
version: "1.30"
893+
- default: true
894+
lockToDefault: false
895+
preRelease: Beta
892896
version: "1.33"
893897
- name: PersistentVolumeLastPhaseTransitionTime
894898
versionedSpecs:

0 commit comments

Comments
 (0)
Please sign in to comment.