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

@@ -12,6 +12,7 @@ import (
"github.com/aquasecurity/trivy-db/pkg/metadata"
dbTypes "github.com/aquasecurity/trivy-db/pkg/types"
"github.com/aquasecurity/trivy/pkg/commands/artifact"
"github.com/aquasecurity/trivy/pkg/commands/option"
"github.com/aquasecurity/trivy/pkg/commands/plugin"
@@ -215,6 +216,12 @@ var (
EnvVars: []string{"TRIVY_K8S_NAMESPACE"},
}
reportFlag = cli.StringFlag{
Name: "report",
Value: "summary",
Usage: "specify a report format for the output. (all,summary default: all)",
}
// TODO: remove this flag after a sufficient deprecation period.
lightFlag = cli.BoolFlag{
Name: "light",
@@ -789,6 +796,7 @@ func NewK8sCommand() *cli.Command {
Action: artifact.K8sRun,
Flags: []cli.Flag{
&namespaceFlag,
&reportFlag,
&outputFlag,
&severityFlag,
&exitCodeFlag,