From bf88ae7d7370dff9cd0e7e3e3688431fd028d10e Mon Sep 17 00:00:00 2001 From: Tim Allclair Date: Tue, 14 Oct 2025 17:22:19 -0700 Subject: [PATCH] Fix DisableAllocatorDualWrite dependency on MultiCIDRServiceAllocator --- pkg/features/kube_features.go | 1 + test/integration/dualstack/dualstack_test.go | 16 ++++++++++++++++ test/integration/servicecidr/allocator_test.go | 10 ++++------ .../servicecidr/feature_enable_disable_test.go | 4 ++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index b24aceb0835..1111047cab9 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -1999,6 +1999,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate // // Entries are alphabetized. var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]featuregate.Feature{ + DisableAllocatorDualWrite: {MultiCIDRServiceAllocator}, InPlacePodVerticalScalingAllocatedStatus: {InPlacePodVerticalScaling}, InPlacePodVerticalScalingExclusiveCPUs: {InPlacePodVerticalScaling}, InPlacePodVerticalScalingExclusiveMemory: {InPlacePodVerticalScaling, MemoryManager}, diff --git a/test/integration/dualstack/dualstack_test.go b/test/integration/dualstack/dualstack_test.go index f6a75e860ad..f3ac97c370e 100644 --- a/test/integration/dualstack/dualstack_test.go +++ b/test/integration/dualstack/dualstack_test.go @@ -45,6 +45,10 @@ import ( func TestCreateServiceSingleStackIPv4(t *testing.T) { for _, enableMultiServiceCIDR := range []bool{false, true} { for _, disableAllocatorDualWrite := range []bool{false, true} { + if !enableMultiServiceCIDR && disableAllocatorDualWrite { + // Inavlid configuration: DisableAllocatorDualWrite depends on MultiServiceCIDR + continue + } t.Run(fmt.Sprintf("MultiServiceCIDR=%v DisableAllocatorDualWrite=%v", enableMultiServiceCIDR, disableAllocatorDualWrite), func(t *testing.T) { // Create an IPv4 single stack control-plane tCtx := ktesting.Init(t) @@ -292,6 +296,10 @@ func TestCreateServiceSingleStackIPv4(t *testing.T) { func TestCreateServiceSingleStackIPv6(t *testing.T) { for _, enableMultiServiceCIDR := range []bool{false, true} { for _, disableAllocatorDualWrite := range []bool{false, true} { + if !enableMultiServiceCIDR && disableAllocatorDualWrite { + // Inavlid configuration: DisableAllocatorDualWrite depends on MultiServiceCIDR + continue + } t.Run(fmt.Sprintf("MultiServiceCIDR=%v DisableAllocatorDualWrite=%v", enableMultiServiceCIDR, disableAllocatorDualWrite), func(t *testing.T) { // Create an IPv6 only control-plane tCtx := ktesting.Init(t) @@ -526,6 +534,10 @@ func TestCreateServiceSingleStackIPv6(t *testing.T) { func TestCreateServiceDualStackIPv4IPv6(t *testing.T) { for _, enableMultiServiceCIDR := range []bool{false, true} { for _, disableAllocatorDualWrite := range []bool{false, true} { + if !enableMultiServiceCIDR && disableAllocatorDualWrite { + // Inavlid configuration: DisableAllocatorDualWrite depends on MultiServiceCIDR + continue + } t.Run(fmt.Sprintf("MultiServiceCIDR=%v DisableAllocatorDualWrite=%v", enableMultiServiceCIDR, disableAllocatorDualWrite), func(t *testing.T) { // Create an IPv4IPv6 dual stack control-plane tCtx := ktesting.Init(t) @@ -808,6 +820,10 @@ func TestCreateServiceDualStackIPv4IPv6(t *testing.T) { func TestCreateServiceDualStackIPv6IPv4(t *testing.T) { for _, enableMultiServiceCIDR := range []bool{false, true} { for _, disableAllocatorDualWrite := range []bool{false, true} { + if !enableMultiServiceCIDR && disableAllocatorDualWrite { + // Inavlid configuration: DisableAllocatorDualWrite depends on MultiServiceCIDR + continue + } t.Run(fmt.Sprintf("MultiServiceCIDR=%v DisableAllocatorDualWrite=%v", enableMultiServiceCIDR, disableAllocatorDualWrite), func(t *testing.T) { // Create an IPv6IPv4 dual stack control-plane tCtx := ktesting.Init(t) diff --git a/test/integration/servicecidr/allocator_test.go b/test/integration/servicecidr/allocator_test.go index 1e370d8b886..33a9d17d1a2 100644 --- a/test/integration/servicecidr/allocator_test.go +++ b/test/integration/servicecidr/allocator_test.go @@ -61,11 +61,6 @@ func TestServiceAllocation(t *testing.T) { ipAllocatorGate: true, disableDualWriteGate: true, }, - { - name: "disable dual write with bitmap allocator", - ipAllocatorGate: false, - disableDualWriteGate: true, - }, } for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { @@ -296,6 +291,9 @@ func TestMigrateService(t *testing.T) { // TestSkewedAllocatorsRollback creating an apiserver with the new allocator and // later starting an old apiserver with the bitmap allocator. func TestSkewedAllocatorsRollback(t *testing.T) { + // TODO(#134606): Fix or remove this test. + t.Skip("Temporarily disabled: see http://issues.k8s.io/134606") + svc := func(i int) *v1.Service { return &v1.Service{ ObjectMeta: metav1.ObjectMeta{ @@ -344,7 +342,7 @@ func TestSkewedAllocatorsRollback(t *testing.T) { "--service-cluster-ip-range=10.0.0.0/24", "--disable-admission-plugins=ServiceAccount", "--emulated-version=1.33", - fmt.Sprintf("--feature-gates=%s=false,%s=true", features.MultiCIDRServiceAllocator, features.DisableAllocatorDualWrite)}, + fmt.Sprintf("--feature-gates=%s=false,%s=false", features.MultiCIDRServiceAllocator, features.DisableAllocatorDualWrite)}, etcdOptions) defer s2.TearDownFn() diff --git a/test/integration/servicecidr/feature_enable_disable_test.go b/test/integration/servicecidr/feature_enable_disable_test.go index a17701561cb..042f73812aa 100644 --- a/test/integration/servicecidr/feature_enable_disable_test.go +++ b/test/integration/servicecidr/feature_enable_disable_test.go @@ -53,7 +53,7 @@ func TestEnableDisableServiceCIDR(t *testing.T) { "--service-cluster-ip-range=10.0.0.0/24", "--disable-admission-plugins=ServiceAccount", "--emulated-version=1.33", - fmt.Sprintf("--feature-gates=%s=false", features.MultiCIDRServiceAllocator)}, + fmt.Sprintf("--feature-gates=%s=false,%s=false", features.MultiCIDRServiceAllocator, features.DisableAllocatorDualWrite)}, etcdOptions) client1, err := clientset.NewForConfig(s1.ClientConfig) @@ -115,7 +115,7 @@ func TestEnableDisableServiceCIDR(t *testing.T) { "--service-cluster-ip-range=10.0.0.0/24", "--disable-admission-plugins=ServiceAccount", "--emulated-version=1.33", - fmt.Sprintf("--feature-gates=%s=false", features.MultiCIDRServiceAllocator)}, + fmt.Sprintf("--feature-gates=%s=false,%s=false", features.MultiCIDRServiceAllocator, features.DisableAllocatorDualWrite)}, etcdOptions) defer s3.TearDownFn()