Skip to content

Commit

Permalink
Fix binaries cleanup for eksd/amzn2
Browse files Browse the repository at this point in the history
Signed-off-by: Artiom Diomin <kron82@gmail.com>
  • Loading branch information
kron4eg committed May 13, 2021
1 parent 844a20c commit 74e762f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 27 deletions.
11 changes: 10 additions & 1 deletion pkg/scripts/os_amzn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`
Expand Down
17 changes: 0 additions & 17 deletions pkg/scripts/os_rhel.go

This file was deleted.

11 changes: 10 additions & 1 deletion pkg/scripts/testdata/TestRemoveBinariesAmazonLinux.golden
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions test/e2e/eksd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
OperatingSystemCentOS7 OperatingSystem = "centos7"
OperatingSystemCentOS8 OperatingSystem = "centos"
OperatingSystemFlatcar OperatingSystem = "flatcar"
OperatingSystemAmazon OperatingSystem = "amazon_linux2"
OperatingSystemAmazon OperatingSystem = "amzn2"
OperatingSystemDefault OperatingSystem = ""
)

Expand Down

0 comments on commit 74e762f

Please sign in to comment.