Skip to content

Commit

Permalink
refactor: Separate kube-bench -specific code (#405)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
  • Loading branch information
danielpacak committed Feb 19, 2021
1 parent 1bb07be commit 0c9cf08
Show file tree
Hide file tree
Showing 6 changed files with 451 additions and 293 deletions.
4 changes: 3 additions & 1 deletion pkg/cmd/scan_ciskubebench.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"sync"

"github.com/aquasecurity/starboard/pkg/ext"
"github.com/aquasecurity/starboard/pkg/kubebench"
"github.com/aquasecurity/starboard/pkg/starboard"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -57,7 +58,8 @@ func ScanKubeBenchReports(cf *genericclioptions.ConfigFlags) func(cmd *cobra.Com
}

scheme := starboard.NewScheme()
scanner := kubebench.NewScanner(scheme, kubeClientset, config, opts)
plugin := kubebench.NewKubeBenchPlugin(ext.NewSystemClock(), config)
scanner := kubebench.NewScanner(scheme, kubeClientset, opts, plugin)

kubeClient, err := client.New(kubeConfig, client.Options{
Scheme: scheme,
Expand Down
69 changes: 0 additions & 69 deletions pkg/kubebench/converter.go

This file was deleted.

91 changes: 0 additions & 91 deletions pkg/kubebench/converter_test.go

This file was deleted.

3 changes: 3 additions & 0 deletions pkg/kubebench/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ func (w *rw) FindByOwner(ctx context.Context, node kube.Object) (*v1alpha1.CISKu
Name: node.Name,
}, report)
if err != nil {
if errors.IsNotFound(err) {
return nil, nil
}
return nil, err
}
return report, nil
Expand Down

0 comments on commit 0c9cf08

Please sign in to comment.