Add cloud ipam behind a feature flag

This commit is contained in:
Ole Markus With 2021-09-06 09:58:23 +02:00
parent dc4c559d41
commit 81177dc634
2 changed files with 13 additions and 0 deletions

View File

@ -262,6 +262,11 @@ func TestMinimalIPv6(t *testing.T) {
// TestIPv6CloudIPAM runs the test on a minimum IPv6 configuration, similar to kops create cluster minimal.example.com --zones us-west-1a
func TestIPv6CloudIPAM(t *testing.T) {
featureflag.ParseFlags("+AWSIPv6")
unsetFeatureFlags := func() {
featureflag.ParseFlags("-AWSIPv6")
}
defer unsetFeatureFlags()
newIntegrationTest("minimal-ipv6.example.com", "ipv6-cloudipam").
withAddons(dnsControllerAddon).
runTestTerraformAWS(t)

View File

@ -36,6 +36,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/dns"
"k8s.io/kops/pkg/featureflag"
"k8s.io/kops/pkg/model/components"
"k8s.io/kops/pkg/model/iam"
"k8s.io/kops/upup/pkg/fi"
@ -267,6 +268,13 @@ func validateClusterSpec(spec *kops.ClusterSpec, c *kops.Cluster, fieldPath *fie
}
}
if spec.PodCIDRFromCloud {
if !featureflag.AWSIPv6.Enabled() {
allErrs = append(allErrs, field.Forbidden(fieldPath.Child("podCIDRFromCloud", "serviceAccountExternalPermissions"), "podCIDRFromCloud requires the AWSIPv6 feature flag to be enabled"))
}
}
return allErrs
}