Skip to content

Commit 5d4297a

Browse files
committed
GCP userProvisioned DNS is featuregated
Add validation to make sure that feature gate is enabled when the feature is enabled.
1 parent 3e4316e commit 5d4297a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pkg/types/gcp/validation/featuregates.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
configv1 "github.com/openshift/api/config/v1"
77
"github.com/openshift/installer/pkg/types"
88
"github.com/openshift/installer/pkg/types/featuregates"
9+
"github.com/openshift/installer/pkg/types/gcp"
910
)
1011

1112
// GatedFeatures determines all of the install config fields that should
@@ -23,5 +24,10 @@ func GatedFeatures(c *types.InstallConfig) []featuregates.GatedInstallConfigFeat
2324
Condition: len(g.UserTags) > 0,
2425
Field: field.NewPath("platform", "gcp", "userTags"),
2526
},
27+
{
28+
FeatureGateName: configv1.FeatureGateGCPClusterHostedDNS,
29+
Condition: g.UserProvisionedDNS == gcp.UserProvisionedDNSEnabled,
30+
Field: field.NewPath("platform", "gcp", "userProvisionedDNS"),
31+
},
2632
}
2733
}

pkg/types/validation/featuregate_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ func TestFeatureGates(t *testing.T) {
4747
return c
4848
}(),
4949
},
50+
{
51+
name: "GCP UserProvisionedDNS is not allowed without Feature Gates",
52+
installConfig: func() *types.InstallConfig {
53+
c := validInstallConfig()
54+
c.GCP = validGCPPlatform()
55+
c.GCP.UserProvisionedDNS = gcp.UserProvisionedDNSEnabled
56+
return c
57+
}(),
58+
expected: `^platform.gcp.userProvisionedDNS: Forbidden: this field is protected by the GCPClusterHostedDNS feature gate which must be enabled through either the TechPreviewNoUpgrade or CustomNoUpgrade feature set$`,
59+
},
5060
{
5161
name: "GCP UserLabels is not allowed without Feature Gates",
5262
installConfig: func() *types.InstallConfig {

0 commit comments

Comments
 (0)