feat(kubernetes): Add report flag for summary (#2112)

* feat(k8s): Add report flag for summary
* chore: add headings to the severity columns
* chore: make the default output of k8s summary table

Signed-off-by: Owen Rumney <owen.rumney@aquasec.com>
This commit is contained in:
Owen Rumney
2022-05-13 19:02:01 +01:00
committed by GitHub
parent 5f004f03d9
commit 2ae8faa7a8
9 changed files with 255 additions and 28 deletions

View File

@@ -15,6 +15,7 @@ import (
"github.com/aquasecurity/fanal/analyzer"
"github.com/aquasecurity/fanal/cache"
"github.com/aquasecurity/trivy-db/pkg/db"
"github.com/aquasecurity/trivy/pkg/log"
pkgReport "github.com/aquasecurity/trivy/pkg/report"
k8sReport "github.com/aquasecurity/trivy/pkg/report/k8s"
@@ -76,9 +77,9 @@ func K8sRun(ctx *cli.Context) error {
report.ClusterName = cluster.GetCurrentContext()
if err = k8sReport.Write(report, pkgReport.Option{
Format: "json", // for now json is the default
Format: opt.KubernetesOption.ReportFormat, // for now json is the default
Output: opt.Output,
}); err != nil {
}, opt.Severities); err != nil {
return xerrors.Errorf("unable to write results: %w", err)
}