Skip to content

Commit

Permalink
feat(k8s): rancher rke2 version support (#5988)
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan committed Feb 22, 2024
1 parent 8a3a113 commit cf0f0d0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/aquasecurity/trivy-aws v0.7.2-0.20240212233003-6359c269e5d2
github.com/aquasecurity/trivy-db v0.0.0-20231005141211-4fc651f7ac8d
github.com/aquasecurity/trivy-java-db v0.0.0-20240109071736-184bd7481d48
github.com/aquasecurity/trivy-kubernetes v0.6.3-0.20240118072219-c433b06f98e1
github.com/aquasecurity/trivy-kubernetes v0.6.3
github.com/aquasecurity/trivy-policies v0.9.1-0.20240212232053-c450017d5624
github.com/aws/aws-sdk-go-v2 v1.24.1
github.com/aws/aws-sdk-go-v2/config v1.26.6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ github.com/aquasecurity/trivy-db v0.0.0-20231005141211-4fc651f7ac8d h1:fjI9mkoTU
github.com/aquasecurity/trivy-db v0.0.0-20231005141211-4fc651f7ac8d/go.mod h1:cj9/QmD9N3OZnKQMp+/DvdV+ym3HyIkd4e+F0ZM3ZGs=
github.com/aquasecurity/trivy-java-db v0.0.0-20240109071736-184bd7481d48 h1:JVgBIuIYbwG+ekC5lUHUpGJboPYiCcxiz06RCtz8neI=
github.com/aquasecurity/trivy-java-db v0.0.0-20240109071736-184bd7481d48/go.mod h1:Ldya37FLi0e/5Cjq2T5Bty7cFkzUDwTcPeQua+2M8i8=
github.com/aquasecurity/trivy-kubernetes v0.6.3-0.20240118072219-c433b06f98e1 h1:/LsIHMQJ4SOxZeib/bvLP7S3YDTXJVIsQyS4kIIP0GQ=
github.com/aquasecurity/trivy-kubernetes v0.6.3-0.20240118072219-c433b06f98e1/go.mod h1:v6B8SO2ep718ccGbbjhpzMn6p27IijS+dMb+MeYz3jQ=
github.com/aquasecurity/trivy-kubernetes v0.6.3 h1:Hmo0pefXRsyVYsii62WUQyt3xMHjm37ipPESeWM/LNA=
github.com/aquasecurity/trivy-kubernetes v0.6.3/go.mod h1:v6B8SO2ep718ccGbbjhpzMn6p27IijS+dMb+MeYz3jQ=
github.com/aquasecurity/trivy-policies v0.9.1-0.20240212232053-c450017d5624 h1:OKJa4JRaB54tY3XxrUA5waEPuI+AsNMoz7PR5rkDQj0=
github.com/aquasecurity/trivy-policies v0.9.1-0.20240212232053-c450017d5624/go.mod h1:AHMSfZ86npbvCMRxrGFw51PIfl60FRwXWgrvxWy7EU0=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
Expand Down
2 changes: 0 additions & 2 deletions pkg/k8s/scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,6 @@ func k8sNamespace(ver, nodeName string) string {
namespace = purl.NamespaceEKS
case strings.Contains(ver, "gke"):
namespace = purl.NamespaceGKE
case strings.Contains(ver, "rke2"):
namespace = purl.NamespaceRKE
case strings.Contains(ver, "hotfix"):
if !strings.Contains(nodeName, "aks") {
// Unknown k8s distribution
Expand Down
4 changes: 2 additions & 2 deletions pkg/k8s/scanner/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func TestGeneratePURL(t *testing.T) {
compName: "k8s.io/kubelet",
compVersion: "1.24.11+rke2r1",
nodeName: "ip-10-0-5-23",
want: "pkg:k8s/rke/k8s.io%2Fkubelet@1.24.11%2Brke2r1",
want: "pkg:k8s/k8s.io%2Fkubelet@1.24.11%2Brke2r1",
},
{
name: "OCP",
Expand Down Expand Up @@ -438,7 +438,7 @@ func TestK8sNamespace(t *testing.T) {
name: "Rancher",
compVersion: "1.24.11+rke2r1",
nodeName: "ip-10-0-5-23",
want: "rke",
want: "kubernetes",
},
{
name: "OCP",
Expand Down
3 changes: 0 additions & 3 deletions pkg/purl/purl.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const (
NamespaceEKS = "eks"
NamespaceAKS = "aks"
NamespaceGKE = "gke"
NamespaceRKE = "rke"
NamespaceOCP = "ocp"

TypeUnknown = "unknown"
Expand Down Expand Up @@ -211,8 +210,6 @@ func (p *PackageURL) LangType() ftypes.LangType {
return ftypes.GKE
case NamespaceAKS:
return ftypes.AKS
case NamespaceRKE:
return ftypes.RKE
case NamespaceOCP:
return ftypes.OCP
case "":
Expand Down

0 comments on commit cf0f0d0

Please sign in to comment.