From 14a95098ecfdc2bee3a8a0a130a87482d9412706 Mon Sep 17 00:00:00 2001 From: dbw7 Date: Wed, 14 Aug 2024 10:13:00 -0400 Subject: [PATCH] arm64 RKE2 CNI download logic (#528) * arm64 rke2 cni download logic --- RELEASE_NOTES.md | 2 ++ pkg/kubernetes/artefact_downloader.go | 9 ------- pkg/kubernetes/artefact_downloader_test.go | 28 +++++++++++++++------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c8793c28..7a6ffdbf 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -4,6 +4,8 @@ ## General +* Allow RKE2 deployments with Calico, Cilium and Multus on aarch64 platforms + ## API ### Image Definition Changes diff --git a/pkg/kubernetes/artefact_downloader.go b/pkg/kubernetes/artefact_downloader.go index ce534f8d..28e56e26 100644 --- a/pkg/kubernetes/artefact_downloader.go +++ b/pkg/kubernetes/artefact_downloader.go @@ -92,23 +92,14 @@ func rke2ImageArtefacts(cni string, multusEnabled bool, arch image.Arch) ([]stri case image.CNITypeCanal: artefacts = append(artefacts, fmt.Sprintf(rke2CanalImages, artefactArch)) case image.CNITypeCalico: - if arch == image.ArchTypeARM { - return nil, fmt.Errorf("calico is not supported on %s platforms", arch) - } artefacts = append(artefacts, fmt.Sprintf(rke2CalicoImages, artefactArch)) case image.CNITypeCilium: - if arch == image.ArchTypeARM { - return nil, fmt.Errorf("cilium is not supported on %s platforms", arch) - } artefacts = append(artefacts, fmt.Sprintf(rke2CiliumImages, artefactArch)) default: return nil, fmt.Errorf("unsupported CNI: %s", cni) } if multusEnabled { - if arch == image.ArchTypeARM { - return nil, fmt.Errorf("multus is not supported on %s platforms", arch) - } artefacts = append(artefacts, fmt.Sprintf(rke2MultusImages, artefactArch)) } diff --git a/pkg/kubernetes/artefact_downloader_test.go b/pkg/kubernetes/artefact_downloader_test.go index 41f765b1..1f4ad700 100644 --- a/pkg/kubernetes/artefact_downloader_test.go +++ b/pkg/kubernetes/artefact_downloader_test.go @@ -100,23 +100,33 @@ func TestRKE2ImageArtefacts(t *testing.T) { }, }, { - name: "aarch64 artefacts with calico CNI", - cni: image.CNITypeCalico, - arch: image.ArchTypeARM, - expectedError: "calico is not supported on aarch64 platforms", + name: "aarch64 artefacts with calico CNI", + cni: image.CNITypeCalico, + arch: image.ArchTypeARM, + expectedArtefacts: []string{ + "rke2-images-core.linux-arm64.tar.zst", + "rke2-images-calico.linux-arm64.tar.zst", + }, }, { - name: "aarch64 artefacts with cilium CNI", - cni: image.CNITypeCilium, - arch: image.ArchTypeARM, - expectedError: "cilium is not supported on aarch64 platforms", + name: "aarch64 artefacts with cilium CNI", + cni: image.CNITypeCilium, + arch: image.ArchTypeARM, + expectedArtefacts: []string{ + "rke2-images-core.linux-arm64.tar.zst", + "rke2-images-cilium.linux-arm64.tar.zst", + }, }, { name: "aarch64 artefacts with canal CNI + multus", cni: image.CNITypeCanal, multusEnabled: true, arch: image.ArchTypeARM, - expectedError: "multus is not supported on aarch64 platforms", + expectedArtefacts: []string{ + "rke2-images-core.linux-arm64.tar.zst", + "rke2-images-canal.linux-arm64.tar.zst", + "rke2-images-multus.linux-arm64.tar.zst", + }, }, }