From 745e8a5cab3a0f96544be0bac77d0cac9c637c3f Mon Sep 17 00:00:00 2001 From: Qu Xuan Date: Wed, 10 Apr 2024 18:41:06 +0800 Subject: [PATCH] fix: add amazon linux --- util/imagetools/image_test.go | 8 ++++++++ util/imagetools/imagetools.go | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/util/imagetools/image_test.go b/util/imagetools/image_test.go index c1cc4e5..6da619d 100644 --- a/util/imagetools/image_test.go +++ b/util/imagetools/image_test.go @@ -125,6 +125,14 @@ func TestNormalizeImageInfo(t *testing.T) { OsLang: "", OsArch: "x86_64", }, + { + Name: "EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.24.17, docker: 20.10.*, containerd: 1.7.*)", + OsDistro: "Amazon Linux", + OsType: osprofile.OS_TYPE_LINUX, + OsVersion: "2", + OsLang: "", + OsArch: "x86_64", + }, } for _, image := range images { diff --git a/util/imagetools/imagetools.go b/util/imagetools/imagetools.go index 9005821..1dc70d2 100644 --- a/util/imagetools/imagetools.go +++ b/util/imagetools/imagetools.go @@ -110,7 +110,7 @@ func normalizeOsDistribution(osDist string, imageName string) string { return "Fedora" } else if strings.Contains(osDist, "alma") { return "AlmaLinux" - } else if strings.Contains(osDist, "amazon linux") { + } else if strings.Contains(osDist, "amazon linux") || strings.Contains(osDist, "amazonlinux") { return "Amazon Linux" } else if strings.Contains(osDist, "windows") { for _, ver := range []string{"2003", "2008", "2012", "2016", "2019", "2022"} {