Skip to content

Commit

Permalink
Remove 1.28 feature flag and set it as default version (#6830)
Browse files Browse the repository at this point in the history
* Remove 1.27 feature flag and set it as default version

* gci cluster_test.go
  • Loading branch information
tatlat authored Oct 18, 2023
1 parent 31bab42 commit ef552f7
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 80 deletions.
2 changes: 1 addition & 1 deletion pkg/api/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1alpha1/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 0 additions & 9 deletions pkg/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const (

ExperimentalSelfManagedClusterUpgradeEnvVar = "EXP_SELF_MANAGED_API_UPGRADE"
ExperimentalSelfManagedClusterUpgradeGate = "ExpSelfManagedAPIUpgrade"
K8s128SupportEnvVar = "K8S_1_28_SUPPORT"
)

func FeedGates(featureGates []string) {

Check warning on line 13 in pkg/features/features.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported function FeedGates should have comment or be unexported (revive)
Expand Down Expand Up @@ -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),
}
}
8 changes: 0 additions & 8 deletions pkg/features/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
11 changes: 0 additions & 11 deletions pkg/validations/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
16 changes: 0 additions & 16 deletions pkg/validations/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())
}
9 changes: 0 additions & 9 deletions pkg/validations/createvalidations/preflightvalidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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() {
Expand Down
9 changes: 0 additions & 9 deletions pkg/validations/upgradevalidations/preflightvalidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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() {
Expand Down
16 changes: 0 additions & 16 deletions test/framework/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}

Expand Down Expand Up @@ -849,8 +847,6 @@ func (e *ClusterE2ETest) upgradeCluster(clusterOpts []ClusterE2ETestOpt, command
}
e.buildClusterConfigFile()

e.setFeatureFlagForUnreleasedKubernetesVersion(e.ClusterConfig.Cluster.Spec.KubernetesVersion)

e.UpgradeCluster(commandOpts...)
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ef552f7

Please sign in to comment.