Skip to content

Commit f3cc867

Browse files
committed
CORS-4332: Add GCP to the allowed platforms for dual stack
Added GCP as a platform that supports DualStack on Day-0 Added GCP as a platform that does not support conversion to DualStack on Day-2 Added tests for GCP ** GCP is behind a featuregate. Ensure that these featuregates are enablede before dual stack support is extended to GCP.
1 parent 9d540eb commit f3cc867

3 files changed

Lines changed: 25 additions & 17 deletions

File tree

pkg/network/cluster_config_test.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ func getFeatureGatesWithDualStack() featuregates.FeatureGate {
3838
apifeatures.FeatureGateDNSNameResolver,
3939
apifeatures.FeatureGateOVNObservability,
4040
apifeatures.FeatureGateAWSDualStackInstall,
41-
apifeatures.FeatureGateAzureDualStackInstall},
41+
apifeatures.FeatureGateAzureDualStackInstall,
42+
apifeatures.FeatureGateGCPDualStackInstall,
43+
},
4244
[]configv1.FeatureGateName{},
4345
)
4446
}
@@ -122,6 +124,7 @@ func getFeatureGatesWithIncompleteDualStack() featuregates.FeatureGate {
122124
},
123125
[]configv1.FeatureGateName{
124126
apifeatures.FeatureGateAzureDualStackInstall,
127+
apifeatures.FeatureGateGCPDualStackInstall,
125128
},
126129
)
127130
}
@@ -195,10 +198,10 @@ func TestValidateClusterConfigDualStack(t *testing.T) {
195198
err = ValidateClusterConfig(&configv1.Network{Spec: cc}, client, featureGates)
196199
g.Expect(err).NotTo(HaveOccurred())
197200

198-
// You can't use dual-stack if enabled on an unsupported platform
199-
infrastructure.Status.PlatformStatus.Type = configv1.GCPPlatformType
200-
infrastructure.Status.PlatformStatus.GCP = &configv1.GCPPlatformStatus{
201-
Region: "us-west1",
201+
// DualStack supported only with featuregates
202+
infrastructure.Status.PlatformStatus.Type = configv1.AWSPlatformType
203+
infrastructure.Status.PlatformStatus.AWS = &configv1.AWSPlatformStatus{
204+
Region: "us-east-1",
202205
}
203206
client = fake.NewFakeClient(infrastructure)
204207
err = createProxy(client)
@@ -209,14 +212,13 @@ func TestValidateClusterConfigDualStack(t *testing.T) {
209212
CIDR: "fd01::/48",
210213
HostPrefix: 64,
211214
})
212-
haveError(cc, fmt.Sprintf("%s is not one of the supported platforms for dual stack",
213-
infrastructure.Status.PlatformStatus.Type))
215+
err = ValidateClusterConfig(&configv1.Network{Spec: cc}, client, featureGates)
216+
g.Expect(err).NotTo(HaveOccurred())
214217

215-
// DualStack supported only with featuregates
216-
infrastructure.Status.PlatformStatus.Type = configv1.AWSPlatformType
217-
infrastructure.Status.PlatformStatus.AWS = &configv1.AWSPlatformStatus{
218-
Region: "us-east-1",
219-
}
218+
// DualStack with supported platform but missing featuregate
219+
featureGates = getFeatureGatesWithIncompleteDualStack()
220+
infrastructure.Status.PlatformStatus.Type = configv1.AzurePlatformType
221+
infrastructure.Status.PlatformStatus.Azure = &configv1.AzurePlatformStatus{}
220222
client = fake.NewFakeClient(infrastructure)
221223
err = createProxy(client)
222224
g.Expect(err).NotTo(HaveOccurred())
@@ -227,12 +229,13 @@ func TestValidateClusterConfigDualStack(t *testing.T) {
227229
HostPrefix: 64,
228230
})
229231
err = ValidateClusterConfig(&configv1.Network{Spec: cc}, client, featureGates)
230-
g.Expect(err).NotTo(HaveOccurred())
232+
haveError(cc, fmt.Sprintf("%s is not one of the supported platforms for dual stack",
233+
infrastructure.Status.PlatformStatus.Type))
231234

232235
// DualStack with supported platform but missing featuregate
233236
featureGates = getFeatureGatesWithIncompleteDualStack()
234-
infrastructure.Status.PlatformStatus.Type = configv1.AzurePlatformType
235-
infrastructure.Status.PlatformStatus.Azure = &configv1.AzurePlatformStatus{}
237+
infrastructure.Status.PlatformStatus.Type = configv1.GCPPlatformType
238+
infrastructure.Status.PlatformStatus.GCP = &configv1.GCPPlatformStatus{}
236239
client = fake.NewFakeClient(infrastructure)
237240
err = createProxy(client)
238241
g.Expect(err).NotTo(HaveOccurred())

pkg/network/render.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ func renderAdditionalRoutingCapabilities(conf *operv1.NetworkSpec, manifestDir s
908908
}
909909

910910
// isSupportedDualStackPlatform returns true if the platform supports dual-stack networking
911-
// on Day-0 (initial cluster installation). Some platforms (AWS, Azure) require feature gates
911+
// on Day-0 (initial cluster installation). Some platforms (AWS, Azure, GCP) require feature gates
912912
// to be enabled to support dual-stack.
913913
func isSupportedDualStackPlatform(platformType configv1.PlatformType, featureGates featuregates.FeatureGate) bool {
914914
switch platformType {
@@ -918,6 +918,8 @@ func isSupportedDualStackPlatform(platformType configv1.PlatformType, featureGat
918918
return featureGates.Enabled(apifeatures.FeatureGateAWSDualStackInstall)
919919
case configv1.AzurePlatformType:
920920
return featureGates.Enabled(apifeatures.FeatureGateAzureDualStackInstall)
921+
case configv1.GCPPlatformType:
922+
return featureGates.Enabled(apifeatures.FeatureGateGCPDualStackInstall)
921923
default:
922924
return false
923925
}

pkg/network/render_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ func TestAllowMigrationOnlyForSupportedTypes(t *testing.T) {
219219
HostPrefix: 64,
220220
},
221221
)
222+
222223
// You can't migrate from single-stack to dual-stack if this is anything else but
223224
// BareMetal, NonePlatformType, and VSphere
224225
infra.PlatformType = configv1.GCPPlatformType
@@ -330,7 +331,9 @@ func getDefaultFeatureGatesWithDualStack() featuregates.FeatureGate {
330331
[]configv1.FeatureGateName{apifeatures.FeatureGateDNSNameResolver,
331332
apifeatures.FeatureGateOVNObservability,
332333
apifeatures.FeatureGateAWSDualStackInstall,
333-
apifeatures.FeatureGateAzureDualStackInstall},
334+
apifeatures.FeatureGateAzureDualStackInstall,
335+
apifeatures.FeatureGateGCPDualStackInstall,
336+
},
334337
[]configv1.FeatureGateName{},
335338
)
336339
}

0 commit comments

Comments
 (0)