Skip to content

Commit

Permalink
Remove kindless upgrade feature flag for all the providers (#6879)
Browse files Browse the repository at this point in the history
  • Loading branch information
panktishah26 authored Oct 25, 2023
1 parent ff3526b commit ff55ac1
Show file tree
Hide file tree
Showing 19 changed files with 347 additions and 573 deletions.
4 changes: 1 addition & 3 deletions cmd/eksctl-anywhere/cmd/upgradecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/aws/eks-anywhere/cmd/eksctl-anywhere/cmd/aflag"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/dependencies"
"github.com/aws/eks-anywhere/pkg/features"
"github.com/aws/eks-anywhere/pkg/kubeconfig"
"github.com/aws/eks-anywhere/pkg/logger"
"github.com/aws/eks-anywhere/pkg/providers/tinkerbell/hardware"
Expand Down Expand Up @@ -199,8 +198,7 @@ func (uc *upgradeClusterOptions) upgradeCluster(cmd *cobra.Command, args []strin

upgradeValidations := upgradevalidations.New(validationOpts)

if features.ExperimentalSelfManagedClusterUpgrade().IsActive() && clusterConfig.IsSelfManaged() {
logger.Info("Management kindless upgrade")
if clusterConfig.IsSelfManaged() {
upgrade := management.NewUpgrade(
deps.Provider,
deps.CAPIManager,
Expand Down
7 changes: 1 addition & 6 deletions manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,9 @@ func setupReconcilers(ctx context.Context, setupLog logr.Logger, mgr ctrl.Manage
os.Exit(1)
}

expUpgrades := features.IsActive(features.ExperimentalSelfManagedClusterUpgrade())
if expUpgrades {
setupLog.Info("[EXPERIMENTAL] Self-managed cluster upgrades enabled. Proceed with caution, this is not intended for production scenarios.")
}

factory := controllers.NewFactory(ctrl.Log, mgr).
WithClusterReconciler(
providers, controllers.WithExperimentalSelfManagedClusterUpgrades(expUpgrades),
providers,
).
WithVSphereDatacenterReconciler().
WithSnowMachineConfigReconciler().
Expand Down
49 changes: 12 additions & 37 deletions pkg/api/v1alpha1/cluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/aws/eks-anywhere/pkg/features"
"github.com/aws/eks-anywhere/pkg/semver"
)

Expand Down Expand Up @@ -378,49 +377,25 @@ func validateImmutableFieldsCluster(new, old *Cluster) field.ErrorList {
}
}

if !old.IsSelfManaged() || features.IsActive(features.ExperimentalSelfManagedClusterUpgrade()) {
oldAWSIamConfig, newAWSIamConfig := &Ref{}, &Ref{}
for _, identityProvider := range new.Spec.IdentityProviderRefs {
if identityProvider.Kind == AWSIamConfigKind {
newAWSIamConfig = &identityProvider
break
}
}

for _, identityProvider := range old.Spec.IdentityProviderRefs {
if identityProvider.Kind == AWSIamConfigKind {
oldAWSIamConfig = &identityProvider
break
}
}

if !oldAWSIamConfig.Equal(newAWSIamConfig) {
allErrs = append(
allErrs,
field.Forbidden(specPath.Child("identityProviderRefs", AWSIamConfigKind), fmt.Sprintf("field is immutable %v", newAWSIamConfig.Kind)))
oldAWSIamConfig, newAWSIamConfig := &Ref{}, &Ref{}
for _, identityProvider := range new.Spec.IdentityProviderRefs {
if identityProvider.Kind == AWSIamConfigKind {
newAWSIamConfig = &identityProvider
break
}
return allErrs
}

clusterlog.Info("Cluster config is associated with management cluster", "name", old.Name)

if !RefSliceEqual(new.Spec.IdentityProviderRefs, old.Spec.IdentityProviderRefs) {
allErrs = append(
allErrs,
field.Forbidden(specPath.Child("IdentityProviderRefs"), fmt.Sprintf("field is immutable %v", new.Spec.IdentityProviderRefs)))
}

if old.Spec.KubernetesVersion != new.Spec.KubernetesVersion {
allErrs = append(
allErrs,
field.Forbidden(specPath.Child("kubernetesVersion"), fmt.Sprintf("field is immutable %v", new.Spec.KubernetesVersion)),
)
for _, identityProvider := range old.Spec.IdentityProviderRefs {
if identityProvider.Kind == AWSIamConfigKind {
oldAWSIamConfig = &identityProvider
break
}
}

if !old.Spec.ControlPlaneConfiguration.Equal(&new.Spec.ControlPlaneConfiguration) {
if !oldAWSIamConfig.Equal(newAWSIamConfig) {
allErrs = append(
allErrs,
field.Forbidden(specPath.Child("ControlPlaneConfiguration"), fmt.Sprintf("field is immutable %v", new.Spec.ControlPlaneConfiguration)))
field.Forbidden(specPath.Child("identityProviderRefs", AWSIamConfigKind), fmt.Sprintf("field is immutable %v", newAWSIamConfig.Kind)))
}

return allErrs
Expand Down
Loading

0 comments on commit ff55ac1

Please sign in to comment.