test/e2e/apimachinery/namespace.go: make OrderedNamespaceDeletion test serial

With OrderedNamespaceDeletion enabled by default, the namespace
controller now deletes resources before deleting the namespace itself.
At the same time, some existing tests create many resources. When
those tests finish around the same time, the namespace controller can
become overloaded. As a result, it may take longer to start deleting
resources created by this test.

Initially, this patch increased the test timeout to account for that
delay. However, the test still flaked in 1 out of 10 jobs, which
suggests increasing the timeouts isn't enough.
Once the test was made serial, no flakes were observed.
This commit is contained in:
Fabio Bertinatto
2025-05-22 14:20:17 -03:00
parent b5608aea94
commit 466fb81528
2 changed files with 3 additions and 6 deletions

View File

@@ -20,11 +20,12 @@ import (
"context"
"encoding/json"
"fmt"
"k8s.io/kubernetes/pkg/features"
"strings"
"sync"
"time"
"k8s.io/kubernetes/pkg/features"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -481,7 +482,7 @@ var _ = SIGDescribe("OrderedNamespaceDeletion", func() {
f := framework.NewDefaultFramework("namespacedeletion")
f.NamespacePodSecurityLevel = admissionapi.LevelBaseline
f.It("namespace deletion should delete pod first", feature.OrderedNamespaceDeletion, framework.WithFeatureGate(features.OrderedNamespaceDeletion), func(ctx context.Context) {
f.It("namespace deletion should delete pod first", framework.WithFeatureGate(features.OrderedNamespaceDeletion), framework.WithSerial(), func(ctx context.Context) {
ensurePodsAreRemovedFirstInOrderedNamespaceDeletion(ctx, f)
})
})

View File

@@ -313,10 +313,6 @@ var (
// Tests aiming to verify oom_score functionality
OOMScoreAdj = framework.WithFeature(framework.ValidFeatures.Add("OOMScoreAdj"))
// Owner: sig-api-machinery
// Marks tests that enforce ordered namespace deletion.
OrderedNamespaceDeletion = framework.WithFeature(framework.ValidFeatures.Add("OrderedNamespaceDeletion"))
// Owner: sig-node
// Verify ProcMount feature.
// Used in combination with user namespaces