From 8685792a0c99cbd8f4a12562a63a3d86ebef2f95 Mon Sep 17 00:00:00 2001 From: chenk Date: Tue, 19 Mar 2024 15:32:43 +0200 Subject: [PATCH] fix: node-collector resources (#318) Signed-off-by: chenk --- pkg/trivyk8s/trivyk8s.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pkg/trivyk8s/trivyk8s.go b/pkg/trivyk8s/trivyk8s.go index 2fd11b1..eaba081 100644 --- a/pkg/trivyk8s/trivyk8s.go +++ b/pkg/trivyk8s/trivyk8s.go @@ -341,19 +341,13 @@ func (c *client) ListClusterBomInfo(ctx context.Context) ([]*artifacts.Artifact, if err != nil { return []*artifacts.Artifact{}, err } - return c.BomToArtifacts(b) + return BomToArtifacts(b) } -func (cl *client) BomToArtifacts(b *bom.Result) ([]*artifacts.Artifact, error) { +func BomToArtifacts(b *bom.Result) ([]*artifacts.Artifact, error) { artifactList := make([]*artifacts.Artifact, 0) for _, c := range b.Components { - if filterResources(cl.includeKinds, cl.excludeKinds, "Pod") { - continue - } - if filterResources(cl.includeNamespaces, cl.excludeNamespaces, c.Namespace) { - continue - } rawResource, err := rawResource(&c) if err != nil { return []*artifacts.Artifact{}, err @@ -365,9 +359,6 @@ func (cl *client) BomToArtifacts(b *bom.Result) ([]*artifacts.Artifact, error) { if err != nil { return []*artifacts.Artifact{}, err } - if filterResources(cl.includeKinds, cl.excludeKinds, "Node") { - continue - } artifactList = append(artifactList, &artifacts.Artifact{Kind: "NodeComponents", Name: ni.NodeName, RawResource: rawResource}) } cr, err := rawResource(&bom.Result{ID: b.ID, Type: "ClusterInfo", Version: b.Version, Properties: b.Properties})