mirror of
https://github.com/aquasecurity/kube-bench.git
synced 2026-02-14 18:10:00 +00:00
add CIS Benchmark for eks-v1.7 (#1916)
* add CIS Benchmark for eks-v1.7 * fix failed test cases * added eks 1.7 for supported kubernetes version * added eks 1.7 for supported kubernetes version * fix failed test cases * add test cases for it * fix * add test case for eks 1.5 * change methodoloy * fix the issue mentioned in pr * fix linter error * Update cmd/util.go Co-authored-by: afdesk <work@afdesk.com> * fix the failed test --------- Co-authored-by: afdesk <work@afdesk.com>
This commit is contained in:
@@ -474,6 +474,12 @@ func TestValidTargets(t *testing.T) {
|
||||
targets: []string{"node", "policies", "controlplane", "managedservices"},
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "eks-1.7.0 valid",
|
||||
benchmark: "eks-1.7.0",
|
||||
targets: []string{"node", "policies", "controlplane", "managedservices"},
|
||||
expected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/fatih/color"
|
||||
"github.com/golang/glog"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
@@ -521,7 +522,11 @@ func getPlatformBenchmarkVersion(platform Platform) string {
|
||||
glog.V(3).Infof("getPlatformBenchmarkVersion platform: %s", platform)
|
||||
switch platform.Name {
|
||||
case "eks":
|
||||
return "eks-1.5.0"
|
||||
oldEKSVersions := []string{"1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25", "1.26", "1.27", "1.28"}
|
||||
if slices.Contains(oldEKSVersions, platform.Version) {
|
||||
return "eks-1.5.0"
|
||||
}
|
||||
return "eks-1.7.0"
|
||||
case "aks":
|
||||
return "aks-1.7"
|
||||
case "gke":
|
||||
|
||||
@@ -651,9 +651,16 @@ func Test_getPlatformBenchmarkVersion(t *testing.T) {
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "eks",
|
||||
name: "eks 1.31",
|
||||
args: args{
|
||||
platform: Platform{Name: "eks"},
|
||||
platform: Platform{Name: "eks", Version: "1.31"},
|
||||
},
|
||||
want: "eks-1.7.0",
|
||||
},
|
||||
{
|
||||
name: "eks 1.24",
|
||||
args: args{
|
||||
platform: Platform{Name: "eks", Version: "1.24"},
|
||||
},
|
||||
want: "eks-1.5.0",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user