diff --git a/pkg/scripts/os_amzn.go b/pkg/scripts/os_amzn.go index b0e2eb821..79026c4d7 100644 --- a/pkg/scripts/os_amzn.go +++ b/pkg/scripts/os_amzn.go @@ -164,14 +164,23 @@ sudo systemctl restart kubelet ` removeBinariesAmazonLinuxScriptTemplate = ` -# Stop kubelet sudo systemctl stop kubelet || true + +sudo yum versionlock delete kubelet kubeadm kubectl kubernetes-cni +sudo yum remove -y \ + kubelet \ + kubeadm \ + kubectl \ + kubernetes-cni + +# Stop kubelet # Remove CNI and binaries sudo rm -rf /opt/cni /opt/bin/kubeadm /opt/bin/kubectl /opt/bin/kubelet # Remove symlinks sudo rm -rf /usr/bin/kubeadm /usr/bin/kubectl /usr/bin/kubelet # Remove systemd unit files sudo rm -f /etc/systemd/system/kubelet.service /etc/systemd/system/kubelet.service.d/10-kubeadm.conf + # Reload systemd sudo systemctl daemon-reload ` diff --git a/pkg/scripts/os_rhel.go b/pkg/scripts/os_rhel.go deleted file mode 100644 index 26cfe9e8d..000000000 --- a/pkg/scripts/os_rhel.go +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2021 The KubeOne Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package scripts diff --git a/pkg/scripts/testdata/TestRemoveBinariesAmazonLinux.golden b/pkg/scripts/testdata/TestRemoveBinariesAmazonLinux.golden index 31c0dea26..f65cea6ae 100644 --- a/pkg/scripts/testdata/TestRemoveBinariesAmazonLinux.golden +++ b/pkg/scripts/testdata/TestRemoveBinariesAmazonLinux.golden @@ -1,13 +1,22 @@ set -xeu pipefail export "PATH=$PATH:/sbin:/usr/local/bin:/opt/bin" -# Stop kubelet sudo systemctl stop kubelet || true + +sudo yum versionlock delete kubelet kubeadm kubectl kubernetes-cni +sudo yum remove -y \ + kubelet \ + kubeadm \ + kubectl \ + kubernetes-cni + +# Stop kubelet # Remove CNI and binaries sudo rm -rf /opt/cni /opt/bin/kubeadm /opt/bin/kubectl /opt/bin/kubelet # Remove symlinks sudo rm -rf /usr/bin/kubeadm /usr/bin/kubectl /usr/bin/kubelet # Remove systemd unit files sudo rm -f /etc/systemd/system/kubelet.service /etc/systemd/system/kubelet.service.d/10-kubeadm.conf + # Reload systemd sudo systemctl daemon-reload diff --git a/test/e2e/eksd.go b/test/e2e/eksd.go index 0c3045aff..0e984e1bc 100644 --- a/test/e2e/eksd.go +++ b/test/e2e/eksd.go @@ -88,13 +88,6 @@ func EksdTerraformFlags(provider string) ([]string, error) { flags := []string{ "-var", "initial_machinedeployment_replicas=0", "-var", "static_workers_count=3", - // Amazon Linux 2 is currently not supported by machine-controller. - // If we would try to create a MachineDeployment using Amazon Linux, - // the validation webhook (and therefore cluster provisioning) - // would fail. - // TODO: Remove this once machine-controller supports Amazon - // Linux 2. - "-var", "worker_os=ubuntu", } return flags, nil } diff --git a/test/e2e/os.go b/test/e2e/os.go index 70a98c9bb..afad66eaf 100644 --- a/test/e2e/os.go +++ b/test/e2e/os.go @@ -30,7 +30,7 @@ const ( OperatingSystemCentOS7 OperatingSystem = "centos7" OperatingSystemCentOS8 OperatingSystem = "centos" OperatingSystemFlatcar OperatingSystem = "flatcar" - OperatingSystemAmazon OperatingSystem = "amazon_linux2" + OperatingSystemAmazon OperatingSystem = "amzn2" OperatingSystemDefault OperatingSystem = "" )