Skip to content

Commit

Permalink
Merge pull request #31 from josedonizetti/fix-duplicate-artifact
Browse files Browse the repository at this point in the history
Fix duplicate artifact
  • Loading branch information
josedonizetti authored May 20, 2022
2 parents 50203a4 + 6a60899 commit 52e1af1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/aquasecurity/trivy-kubernetes
go 1.18

require (
github.com/stretchr/testify v1.7.1
k8s.io/apimachinery v0.23.6
k8s.io/cli-runtime v0.23.6
k8s.io/client-go v0.23.6
Expand Down Expand Up @@ -50,7 +51,6 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/cobra v1.2.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.7.1 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
Expand Down
5 changes: 3 additions & 2 deletions pkg/k8s/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ func (c *cluster) GetGVRs(namespaced bool) ([]schema.GroupVersionResource, error
}

for _, resource := range resources {
list, err := c.restMapper.ResourcesFor(schema.GroupVersionResource{Resource: resource})
gvr, err := c.GetGVR(resource)
if err != nil {
return nil, err
}

grvs = append(grvs, list...)
grvs = append(grvs, gvr)
}

return grvs, nil
Expand All @@ -139,6 +139,7 @@ func (c *cluster) GetGVR(kind string) (schema.GroupVersionResource, error) {
return c.restMapper.ResourceFor(schema.GroupVersionResource{Resource: kind})
}

// IsClusterResource returns if a GVR is a cluster resource
func IsClusterResource(gvr schema.GroupVersionResource) bool {
for _, r := range getClusterResources() {
if gvr.Resource == r {
Expand Down

0 comments on commit 52e1af1

Please sign in to comment.