Skip to content

Commit

Permalink
Remove K8s 1.30 feature flag and default as cluster version (#8228)
Browse files Browse the repository at this point in the history
* Remove K8s 1.30 feature flag and default as cluster version

Signed-off-by: Rahul Ganesh <rahulgab@amazon.com>

* Fix CI

---------

Signed-off-by: Rahul Ganesh <rahulgab@amazon.com>
Co-authored-by: Rahul Ganesh <rahulgab@amazon.com>
  • Loading branch information
rahulbabu95 and Rahul Ganesh authored May 31, 2024
1 parent 8438b97 commit 6443b30
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 68 deletions.
2 changes: 1 addition & 1 deletion pkg/api/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func GetAndValidateClusterConfig(fileName string) (*Cluster, error) {

// GetClusterDefaultKubernetesVersion returns the default kubernetes version for a Cluster.
func GetClusterDefaultKubernetesVersion() KubernetesVersion {
return Kube129
return Kube130
}

// 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 @@ -3980,7 +3980,7 @@ func TestValidateEksaVersion(t *testing.T) {

func TestGetClusterDefaultKubernetesVersion(t *testing.T) {
g := NewWithT(t)
g.Expect(GetClusterDefaultKubernetesVersion()).To(Equal(Kube129))
g.Expect(GetClusterDefaultKubernetesVersion()).To(Equal(Kube130))
}

func TestClusterWorkerNodeConfigCount(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1alpha1/testdata/cluster_in_place_upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
upgradeRolloutStrategy:
type: InPlace
datacenterRef: {}
kubernetesVersion: "1.29"
kubernetesVersion: "1.30"
managementCluster:
name: test-cluster
workerNodeGroupConfigurations:
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 (
UseControllerForCli = "USE_CONTROLLER_FOR_CLI"
VSphereInPlaceEnvVar = "VSPHERE_IN_PLACE_UPGRADE"
APIServerExtraArgsEnabledEnvVar = "API_SERVER_EXTRA_ARGS_ENABLED"
K8s130SupportEnvVar = "K8S_1_30_SUPPORT"
)

func FeedGates(featureGates []string) {
Expand Down Expand Up @@ -65,11 +64,3 @@ func APIServerExtraArgsEnabled() Feature {
IsActive: globalFeatures.isActiveForEnvVar(APIServerExtraArgsEnabledEnvVar),
}
}

// K8s130Support is the feature flag for Kubernetes 1.30 support.
func K8s130Support() Feature {
return Feature{
Name: "Kubernetes version 1.30 support",
IsActive: globalFeatures.isActiveForEnvVar(K8s130SupportEnvVar),
}
}
8 changes: 0 additions & 8 deletions pkg/features/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,3 @@ func TestAPIServerExtraArgsEnabledFeatureFlag(t *testing.T) {
g.Expect(os.Setenv(APIServerExtraArgsEnabledEnvVar, "true")).To(Succeed())
g.Expect(IsActive(APIServerExtraArgsEnabled())).To(BeTrue())
}

func TestWithK8s130FeatureFlag(t *testing.T) {
g := NewWithT(t)
setupContext(t)

g.Expect(os.Setenv(K8s130SupportEnvVar, "true")).To(Succeed())
g.Expect(IsActive(K8s130Support())).To(BeTrue())
}
11 changes: 0 additions & 11 deletions pkg/validations/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/config"
"github.com/aws/eks-anywhere/pkg/constants"
"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 @@ -268,13 +267,3 @@ func ValidateManagementComponentsVersionSkew(ctx context.Context, k KubectlClien
}
return nil
}

// ValidateK8s130Support checks if the 1.30 feature flag is set when using k8s 1.30.
func ValidateK8s130Support(clusterSpec *cluster.Spec) error {
if !features.IsActive(features.K8s130Support()) {
if clusterSpec.Cluster.Spec.KubernetesVersion == v1alpha1.Kube130 {
return fmt.Errorf("kubernetes version %s is not enabled. Please set the env variable %v", v1alpha1.Kube130, features.K8s130SupportEnvVar)
}
}
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 @@ -15,7 +15,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 @@ -743,18 +742,3 @@ func TestValidateManagementComponentsVersionSkew(t *testing.T) {
})
}
}

func TestValidateK8s130Support(t *testing.T) {
tt := newTest(t)
tt.clusterSpec.Cluster.Spec.KubernetesVersion = anywherev1.Kube130
tt.Expect(validations.ValidateK8s130Support(tt.clusterSpec)).To(
MatchError(ContainSubstring("kubernetes version 1.30 is not enabled. Please set the env variable K8S_1_30_SUPPORT")))
}

func TestValidateK8s130SupportActive(t *testing.T) {
tt := newTest(t)
tt.clusterSpec.Cluster.Spec.KubernetesVersion = anywherev1.Kube130
features.ClearCache()
os.Setenv(features.K8s130SupportEnvVar, "true")
tt.Expect(validations.ValidateK8s130Support(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 @@ -7,7 +7,6 @@ import (
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/config"
"github.com/aws/eks-anywhere/pkg/constants"
"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 @@ -50,14 +49,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.30 support",
Remediation: fmt.Sprintf("ensure %v env variable is set", features.K8s130SupportEnvVar),
Err: validations.ValidateK8s130Support(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 @@ -9,7 +9,6 @@ import (
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/config"
"github.com/aws/eks-anywhere/pkg/constants"
"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 @@ -123,14 +122,6 @@ func (u *UpgradeValidations) PreflightValidations(ctx context.Context) []validat
Err: validations.ValidatePauseAnnotation(ctx, k, targetCluster, targetCluster.Name),
}
},
func() *validations.ValidationResult {
return &validations.ValidationResult{
Name: "validate kubernetes version 1.30 support",
Remediation: fmt.Sprintf("ensure %v env variable is set", features.K8s130SupportEnvVar),
Err: validations.ValidateK8s130Support(u.Opts.Spec),
Silent: true,
}
},
}

if u.Opts.Spec.Cluster.IsManaged() {
Expand Down
4 changes: 1 addition & 3 deletions test/framework/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/constants"
"github.com/aws/eks-anywhere/pkg/executables"
"github.com/aws/eks-anywhere/pkg/features"
"github.com/aws/eks-anywhere/pkg/filewriter"
"github.com/aws/eks-anywhere/pkg/git"
"github.com/aws/eks-anywhere/pkg/providers/cloudstack/decoder"
Expand Down Expand Up @@ -2153,12 +2152,11 @@ func dumpFile(description, path string, t T) {
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.Kube130
var unreleasedK8sVersion v1alpha1.KubernetesVersion

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.K8s130SupportEnvVar, "true")
}
}

Expand Down

0 comments on commit 6443b30

Please sign in to comment.