From ef552f7d449b20b7b66ef8ad7066e98a507008b4 Mon Sep 17 00:00:00 2001 From: Tanvir Tatla Date: Tue, 17 Oct 2023 18:53:58 -0700 Subject: [PATCH] Remove 1.28 feature flag and set it as default version (#6830) * Remove 1.27 feature flag and set it as default version * gci cluster_test.go --- pkg/api/v1alpha1/cluster.go | 2 +- pkg/api/v1alpha1/cluster_test.go | 2 +- pkg/features/features.go | 9 --------- pkg/features/features_test.go | 8 -------- pkg/validations/cluster.go | 11 ----------- pkg/validations/cluster_test.go | 16 ---------------- .../createvalidations/preflightvalidations.go | 9 --------- .../upgradevalidations/preflightvalidations.go | 9 --------- test/framework/cluster.go | 16 ---------------- 9 files changed, 2 insertions(+), 80 deletions(-) diff --git a/pkg/api/v1alpha1/cluster.go b/pkg/api/v1alpha1/cluster.go index 76c25dbeadbe..6fcc04fdf2c3 100644 --- a/pkg/api/v1alpha1/cluster.go +++ b/pkg/api/v1alpha1/cluster.go @@ -221,7 +221,7 @@ func GetAndValidateClusterConfig(fileName string) (*Cluster, error) { // GetClusterDefaultKubernetesVersion returns the default kubernetes version for a Cluster. func GetClusterDefaultKubernetesVersion() KubernetesVersion { - return Kube127 + return Kube128 } // ValidateClusterConfigContent validates a Cluster object without modifying it diff --git a/pkg/api/v1alpha1/cluster_test.go b/pkg/api/v1alpha1/cluster_test.go index 1e2018de84a3..42f000522ebd 100644 --- a/pkg/api/v1alpha1/cluster_test.go +++ b/pkg/api/v1alpha1/cluster_test.go @@ -3502,7 +3502,7 @@ func TestValidateEksaVersion(t *testing.T) { func TestGetClusterDefaultKubernetesVersion(t *testing.T) { g := NewWithT(t) - g.Expect(GetClusterDefaultKubernetesVersion()).To(Equal(Kube127)) + g.Expect(GetClusterDefaultKubernetesVersion()).To(Equal(Kube128)) } func TestClusterWorkerNodeConfigCount(t *testing.T) { diff --git a/pkg/features/features.go b/pkg/features/features.go index 6c282ead4a4f..ed47a79c6bae 100644 --- a/pkg/features/features.go +++ b/pkg/features/features.go @@ -8,7 +8,6 @@ const ( ExperimentalSelfManagedClusterUpgradeEnvVar = "EXP_SELF_MANAGED_API_UPGRADE" ExperimentalSelfManagedClusterUpgradeGate = "ExpSelfManagedAPIUpgrade" - K8s128SupportEnvVar = "K8S_1_28_SUPPORT" ) func FeedGates(featureGates []string) { @@ -60,11 +59,3 @@ func UseNewWorkflows() Feature { IsActive: globalFeatures.isActiveForEnvVar(UseNewWorkflowsEnvVar), } } - -// K8s128Support is the feature flag for Kubernetes 1.27 support. -func K8s128Support() Feature { - return Feature{ - Name: "Kubernetes version 1.28 support", - IsActive: globalFeatures.isActiveForEnvVar(K8s128SupportEnvVar), - } -} diff --git a/pkg/features/features_test.go b/pkg/features/features_test.go index 7cc20e6bbd01..6229980d8050 100644 --- a/pkg/features/features_test.go +++ b/pkg/features/features_test.go @@ -69,11 +69,3 @@ func TestIsActiveWithFeatureGatesTrue(t *testing.T) { g.Expect(IsActive(fakeFeatureWithGate())).To(BeTrue()) } - -func TestWithK8s128FeatureFlag(t *testing.T) { - g := NewWithT(t) - setupContext(t) - - g.Expect(os.Setenv(K8s128SupportEnvVar, "true")).To(Succeed()) - g.Expect(IsActive(K8s128Support())).To(BeTrue()) -} diff --git a/pkg/validations/cluster.go b/pkg/validations/cluster.go index 48ef78fbe600..c0b3bf1aaecd 100644 --- a/pkg/validations/cluster.go +++ b/pkg/validations/cluster.go @@ -8,7 +8,6 @@ import ( "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/config" - "github.com/aws/eks-anywhere/pkg/features" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/providers" "github.com/aws/eks-anywhere/pkg/semver" @@ -205,13 +204,3 @@ func parseClusterEksaVersion(mgmtCluster, cluster *v1alpha1.Cluster) (*semver.Ve return mVersion, wVersion, nil } - -// ValidateK8s128Support checks if the 1.28 feature flag is set when using k8s 1.28. -func ValidateK8s128Support(clusterSpec *cluster.Spec) error { - if !features.IsActive(features.K8s128Support()) { - if clusterSpec.Cluster.Spec.KubernetesVersion == v1alpha1.Kube128 { - return fmt.Errorf("kubernetes version %s is not enabled. Please set the env variable %v", v1alpha1.Kube128, features.K8s128SupportEnvVar) - } - } - return nil -} diff --git a/pkg/validations/cluster_test.go b/pkg/validations/cluster_test.go index a5a90edec8b1..252d5ae3711c 100644 --- a/pkg/validations/cluster_test.go +++ b/pkg/validations/cluster_test.go @@ -14,7 +14,6 @@ import ( "github.com/aws/eks-anywhere/internal/test" anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/cluster" - "github.com/aws/eks-anywhere/pkg/features" "github.com/aws/eks-anywhere/pkg/providers" providermocks "github.com/aws/eks-anywhere/pkg/providers/mocks" "github.com/aws/eks-anywhere/pkg/types" @@ -509,18 +508,3 @@ func TestValidateManagementClusterEksaVersion(t *testing.T) { }) } } - -func TestValidateK8s128Support(t *testing.T) { - tt := newTest(t) - tt.clusterSpec.Cluster.Spec.KubernetesVersion = anywherev1.Kube128 - tt.Expect(validations.ValidateK8s128Support(tt.clusterSpec)).To( - MatchError(ContainSubstring("kubernetes version 1.28 is not enabled. Please set the env variable K8S_1_28_SUPPORT"))) -} - -func TestValidateK8s128SupportActive(t *testing.T) { - tt := newTest(t) - tt.clusterSpec.Cluster.Spec.KubernetesVersion = anywherev1.Kube128 - features.ClearCache() - os.Setenv(features.K8s128SupportEnvVar, "true") - tt.Expect(validations.ValidateK8s128Support(tt.clusterSpec)).To(Succeed()) -} diff --git a/pkg/validations/createvalidations/preflightvalidations.go b/pkg/validations/createvalidations/preflightvalidations.go index c3ef3ee6a643..e7c89312089b 100644 --- a/pkg/validations/createvalidations/preflightvalidations.go +++ b/pkg/validations/createvalidations/preflightvalidations.go @@ -6,7 +6,6 @@ import ( anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/config" - "github.com/aws/eks-anywhere/pkg/features" "github.com/aws/eks-anywhere/pkg/types" "github.com/aws/eks-anywhere/pkg/validations" ) @@ -49,14 +48,6 @@ func (v *CreateValidations) PreflightValidations(ctx context.Context) []validati Err: validations.ValidateEksaVersion(ctx, v.Opts.CliVersion, v.Opts.Spec), } }, - func() *validations.ValidationResult { - return &validations.ValidationResult{ - Name: "validate kubernetes version 1.28 support", - Remediation: fmt.Sprintf("ensure %v env variable is set", features.K8s128SupportEnvVar), - Err: validations.ValidateK8s128Support(v.Opts.Spec), - Silent: true, - } - }, } if v.Opts.Spec.Cluster.IsManaged() { diff --git a/pkg/validations/upgradevalidations/preflightvalidations.go b/pkg/validations/upgradevalidations/preflightvalidations.go index 677c1465ce22..a03ae18e9f57 100644 --- a/pkg/validations/upgradevalidations/preflightvalidations.go +++ b/pkg/validations/upgradevalidations/preflightvalidations.go @@ -8,7 +8,6 @@ import ( anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/config" - "github.com/aws/eks-anywhere/pkg/features" "github.com/aws/eks-anywhere/pkg/providers" "github.com/aws/eks-anywhere/pkg/types" "github.com/aws/eks-anywhere/pkg/validation" @@ -114,14 +113,6 @@ func (u *UpgradeValidations) PreflightValidations(ctx context.Context) []validat Err: validations.ValidateEksaVersion(ctx, u.Opts.CliVersion, u.Opts.Spec), } }, - func() *validations.ValidationResult { - return &validations.ValidationResult{ - Name: "validate kubernetes version 1.28 support", - Remediation: fmt.Sprintf("ensure %v env variable is set", features.K8s128SupportEnvVar), - Err: validations.ValidateK8s128Support(u.Opts.Spec), - Silent: true, - } - }, } if u.Opts.Spec.Cluster.IsManaged() { diff --git a/test/framework/cluster.go b/test/framework/cluster.go index 53e69b86211a..59b83fe80e33 100644 --- a/test/framework/cluster.go +++ b/test/framework/cluster.go @@ -701,8 +701,6 @@ func (e *ClusterE2ETest) ChangeInstanceSecurityGroup(securityGroup string) { } func (e *ClusterE2ETest) CreateCluster(opts ...CommandOpt) { - e.setFeatureFlagForUnreleasedKubernetesVersion(e.ClusterConfig.Cluster.Spec.KubernetesVersion) - e.createCluster(opts...) } @@ -849,8 +847,6 @@ func (e *ClusterE2ETest) upgradeCluster(clusterOpts []ClusterE2ETestOpt, command } e.buildClusterConfigFile() - e.setFeatureFlagForUnreleasedKubernetesVersion(e.ClusterConfig.Cluster.Spec.KubernetesVersion) - e.UpgradeCluster(commandOpts...) } @@ -2181,18 +2177,6 @@ func dumpFile(description, path string, t T) { t.Logf("%s:\n%s\n", description, string(b)) } -func (e *ClusterE2ETest) setFeatureFlagForUnreleasedKubernetesVersion(version v1alpha1.KubernetesVersion) { - // Update this variable to equal the feature flagged k8s version when applicable. - // For example, if k8s 1.26 is under a feature flag, we would set this to v1alpha1.Kube126 - unreleasedK8sVersion := v1alpha1.Kube128 - - if version == unreleasedK8sVersion { - // Set feature flag for the unreleased k8s version when applicable - e.T.Logf("Setting k8s version support feature flag...") - os.Setenv(features.K8s128SupportEnvVar, "true") - } -} - // CreateCloudStackCredentialsSecretFromEnvVar parses the cloudstack credentials from an environment variable, // builds a new secret object from the credentials in the provided profile and creates it in the cluster. func (e *ClusterE2ETest) CreateCloudStackCredentialsSecretFromEnvVar(name, profileName string) {