Skip to content

Commit

Permalink
Remove kubernetes 1.27 support
Browse files Browse the repository at this point in the history
Signed-off-by: Waleed Malik <ahmedwaleedmalik@gmail.com>
  • Loading branch information
ahmedwaleedmalik committed Jul 9, 2024
1 parent 843aa90 commit 58f616b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 36 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Currently supported K8S versions are:
- 1.30
- 1.29
- 1.28
- 1.27

### Community Providers

Expand Down
12 changes: 2 additions & 10 deletions pkg/controller/machine/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,7 @@ func (r *Reconciler) reconcile(ctx context.Context, log *zap.SugaredLogger, mach
}

// case 3.2: if the node exists and both external and internal CCM are not available. Then set the provider-id for the node.
inTree, err := providerconfigtypes.IntreeCloudProviderImplementationSupported(providerConfig.CloudProvider, machine.Spec.Versions.Kubelet)
if err != nil {
return nil, fmt.Errorf("failed to check if cloud provider %q has in-tree implementation: %w", providerConfig.CloudProvider, err)
}

inTree := providerconfigtypes.IntreeCloudProviderImplementationSupported(providerConfig.CloudProvider)
if !inTree && !r.nodeSettings.ExternalCloudProvider && node.Spec.ProviderID == "" {
providerID := fmt.Sprintf(ProviderIDPattern, providerConfig.CloudProvider, machine.UID)
if err := r.updateNode(ctx, node, func(n *corev1.Node) {
Expand Down Expand Up @@ -897,11 +893,7 @@ func (r *Reconciler) ensureInstanceExistsForMachine(

var providerID string
if machine.Spec.ProviderID == nil {
inTree, err := providerconfigtypes.IntreeCloudProviderImplementationSupported(providerConfig.CloudProvider, machine.Spec.Versions.Kubelet)
if err != nil {
return nil, fmt.Errorf("failed to check if cloud provider %q has in-tree implementation: %w", providerConfig.CloudProvider, err)
}

inTree := providerconfigtypes.IntreeCloudProviderImplementationSupported(providerConfig.CloudProvider)
// If both external and internal CCM are not available. We set provider-id for the machine explicitly.
if !inTree && !r.nodeSettings.ExternalCloudProvider {
providerID = fmt.Sprintf(ProviderIDPattern, providerConfig.CloudProvider, machine.UID)
Expand Down
24 changes: 4 additions & 20 deletions pkg/providerconfig/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (
"fmt"
"strconv"

"github.com/Masterminds/semver/v3"

clusterv1alpha1 "github.com/kubermatic/machine-controller/pkg/apis/cluster/v1alpha1"
"github.com/kubermatic/machine-controller/pkg/cloudprovider/util"
"github.com/kubermatic/machine-controller/pkg/jsonutil"
Expand Down Expand Up @@ -120,25 +118,11 @@ var (
}
)

func IntreeCloudProviderImplementationSupported(cloudProvider CloudProvider, version string) (inTree bool, err error) {
kubeletVer, err := semver.NewVersion(version)
if err != nil {
return false, fmt.Errorf("failed to parse kubelet version: %w", err)
}

switch cloudProvider {
case CloudProviderAzure, CloudProviderVsphere, CloudProviderGoogle:
return true, nil
case CloudProviderAWS:
// In-tree AWS support was removed in Kubernetes 1.27.
ltKube127Condition, _ := semver.NewConstraint("< 1.27")
if ltKube127Condition.Check(kubeletVer) {
return true, nil
}
return false, nil
default:
return false, nil
func IntreeCloudProviderImplementationSupported(cloudProvider CloudProvider) (inTree bool) {
if cloudProvider == CloudProviderAzure || cloudProvider == CloudProviderVsphere || cloudProvider == CloudProviderGoogle {
return true
}
return false
}

// DNSConfig contains a machine's DNS configuration.
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/provisioning/all_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func TestOpenstackProvisioningE2E(t *testing.T) {
}

// In-tree cloud provider is not supported from Kubernetes v1.26.
selector := And(Not(OsSelector("amzn2")), Not(VersionSelector("1.27.13", "1.28.11", "1.29.6", "1.30.2")))
selector := And(Not(OsSelector("amzn2")), Not(VersionSelector("1.28.11", "1.29.6", "1.30.2")))
runScenarios(context.Background(), t, selector, params, OSManifest, fmt.Sprintf("os-%s", *testRunIdentifier))
}

Expand Down Expand Up @@ -424,7 +424,7 @@ func TestAWSProvisioningE2E(t *testing.T) {
}

// In-tree cloud provider is not supported from Kubernetes v1.27.
selector := Not(VersionSelector("1.27.13", "1.28.11", "1.29.6", "1.30.2"))
selector := Not(VersionSelector("1.28.11", "1.29.6", "1.30.2"))

// act
params := []string{fmt.Sprintf("<< AWS_ACCESS_KEY_ID >>=%s", awsKeyID),
Expand Down Expand Up @@ -478,7 +478,7 @@ func TestAWSSpotInstanceProvisioningE2E(t *testing.T) {
}
// Since we are only testing the spot instance functionality, testing it against a single OS is sufficient.
// In-tree cloud provider is not supported from Kubernetes v1.27.
selector := And(OsSelector("ubuntu"), Not(VersionSelector("1.27.13", "1.28.11", "1.29.6", "1.30.2")))
selector := And(OsSelector("ubuntu"), Not(VersionSelector("1.28.11", "1.29.6", "1.30.2")))

// act
params := []string{fmt.Sprintf("<< AWS_ACCESS_KEY_ID >>=%s", awsKeyID),
Expand All @@ -500,7 +500,7 @@ func TestAWSARMProvisioningE2E(t *testing.T) {
t.Fatal("Unable to run the test suite, AWS_E2E_TESTS_KEY_ID or AWS_E2E_TESTS_SECRET environment variables cannot be empty")
}
// In-tree cloud provider is not supported from Kubernetes v1.27.
selector := And(OsSelector("ubuntu"), Not(VersionSelector("1.27.13", "1.28.11", "1.29.6", "1.30.2")))
selector := And(OsSelector("ubuntu"), Not(VersionSelector("1.28.11", "1.29.6", "1.30.2")))

// act
params := []string{fmt.Sprintf("<< AWS_ACCESS_KEY_ID >>=%s", awsKeyID),
Expand Down
1 change: 0 additions & 1 deletion test/e2e/provisioning/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ var (
scenarios = buildScenarios()

versions = []*semver.Version{
semver.MustParse("v1.27.13"),
semver.MustParse("v1.28.11"),
semver.MustParse("v1.29.6"),
semver.MustParse("v1.30.2"),
Expand Down

0 comments on commit 58f616b

Please sign in to comment.