Skip to content

Commit

Permalink
fix: node-collector resources (#318)
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <[email protected]>
  • Loading branch information
chen-keinan authored Mar 19, 2024
1 parent f00b5e8 commit 8685792
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions pkg/trivyk8s/trivyk8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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})
Expand Down

0 comments on commit 8685792

Please sign in to comment.