Skip to content

Commit 9598e5a

Browse files
committed
Mark the feature gate on by default since it's a security fix.
1 parent d496b6c commit 9598e5a

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

pkg/controller/namespace/deletion/namespaced_resources_deleter.go

Lines changed: 6 additions & 4 deletions
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,8 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
545545
},
546546

547547
OrderedNamespaceDeletion: {
548-
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha},
548+
{Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Beta},
549+
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta},
549550
},
550551

551552
PersistentVolumeLastPhaseTransitionTime: {

test/featuregates_linter/test_data/versioned_feature_list.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,11 @@
864864
versionedSpecs:
865865
- default: false
866866
lockToDefault: false
867-
preRelease: Alpha
867+
preRelease: Beta
868+
version: "1.30"
869+
- default: true
870+
lockToDefault: false
871+
preRelease: Beta
868872
version: "1.33"
869873
- name: PersistentVolumeLastPhaseTransitionTime
870874
versionedSpecs:

0 commit comments

Comments
 (0)