Skip to content

Commit

Permalink
feat: change flag name from skip-intrusive to non-intrusive
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan committed Apr 2, 2024
1 parent ca30ae6 commit c23dcbb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/docs/references/configuration/cli/trivy_kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ trivy kubernetes [flags] { cluster | all | specific resources like kubectl. eg:
--no-progress suppress progress bar
--node-collector-imageref string indicate the image reference for the node-collector scan job (default "ghcr.io/aquasecurity/node-collector:0.0.9")
--node-collector-namespace string specify the namespace in which the node-collector job should be deployed (default "trivy-temp")
--non-intrusive When the flag is activated, the node-collector job will not be executed, thus skipping misconfiguration findings on the node.
--offline-scan do not issue API requests to identify dependencies
-o, --output string output file name
--output-plugin-arg string [EXPERIMENTAL] output plugin arguments
Expand All @@ -90,7 +91,6 @@ trivy kubernetes [flags] { cluster | all | specific resources like kubectl. eg:
--skip-db-update skip updating vulnerability database
--skip-dirs strings specify the directories or glob patterns to skip
--skip-files strings specify the files or glob patterns to skip
--skip-intrusive When the flag is activated, the node-collector job will not be executed, thus skipping misconfiguration findings on the node.
--skip-java-db-update skip updating Java index database
--skip-policy-update skip fetching rego policy updates
-t, --template string output template
Expand Down
14 changes: 7 additions & 7 deletions pkg/flag/kubernetes_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ var (
Shorthand: "A",
Usage: "fetch resources from all cluster namespaces",
}
SkipIntrusive = Flag[bool]{
Name: "skip-intrusive",
NonIntrusive = Flag[bool]{
Name: "non-intrusive",
ConfigName: "kubernetes.non.intrusive",
Usage: "When the flag is activated, the node-collector job will not be executed, thus skipping misconfiguration findings on the node.",
}
Expand Down Expand Up @@ -92,7 +92,7 @@ type K8sFlagGroup struct {
KubeConfig *Flag[string]
K8sVersion *Flag[string]
Tolerations *Flag[[]string]
SkipIntrusive *Flag[bool]
NonIntrusive *Flag[bool]
NodeCollectorImageRef *Flag[string]
AllNamespaces *Flag[bool]
NodeCollectorNamespace *Flag[string]
Expand All @@ -112,7 +112,7 @@ type K8sOptions struct {
AllNamespaces bool
NodeCollectorNamespace string
ExcludeOwned bool
SkipIntrusive bool
NonIntrusive bool
ExcludeNodes map[string]string
QPS float32
Burst int
Expand All @@ -125,7 +125,7 @@ func NewK8sFlagGroup() *K8sFlagGroup {
KubeConfig: KubeConfigFlag.Clone(),
K8sVersion: K8sVersionFlag.Clone(),
Tolerations: TolerationsFlag.Clone(),
SkipIntrusive: SkipIntrusive.Clone(),
NonIntrusive: NonIntrusive.Clone(),
AllNamespaces: AllNamespaces.Clone(),
NodeCollectorNamespace: NodeCollectorNamespace.Clone(),
ExcludeOwned: ExcludeOwned.Clone(),
Expand All @@ -146,7 +146,7 @@ func (f *K8sFlagGroup) Flags() []Flagger {
f.Namespace,
f.KubeConfig,
f.K8sVersion,
f.SkipIntrusive,
f.NonIntrusive,
f.Tolerations,
f.AllNamespaces,
f.NodeCollectorNamespace,
Expand Down Expand Up @@ -184,7 +184,7 @@ func (f *K8sFlagGroup) ToOptions() (K8sOptions, error) {
KubeConfig: f.KubeConfig.Value(),
K8sVersion: f.K8sVersion.Value(),
Tolerations: tolerations,
SkipIntrusive: f.SkipIntrusive.Value(),
NonIntrusive: f.NonIntrusive.Value(),
AllNamespaces: f.AllNamespaces.Value(),
NodeCollectorNamespace: f.NodeCollectorNamespace.Value(),
ExcludeOwned: f.ExcludeOwned.Value(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/commands/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func clusterRun(ctx context.Context, opts flag.Options, cluster k8s.Cluster) err
return xerrors.Errorf("get k8s artifacts with node info error: %w", err)
}
case types.FormatJSON, types.FormatTable:
if opts.Scanners.AnyEnabled(types.MisconfigScanner) && !opts.SkipIntrusive {
if opts.Scanners.AnyEnabled(types.MisconfigScanner) && !opts.NonIntrusive {
artifacts, err = trivyk8s.New(cluster, log.Logger, trivyk8s.WithExcludeOwned(opts.ExcludeOwned)).ListArtifactAndNodeInfo(ctx,
trivyk8s.WithScanJobNamespace(opts.NodeCollectorNamespace),
trivyk8s.WithIgnoreLabels(opts.ExcludeNodes),
Expand Down

0 comments on commit c23dcbb

Please sign in to comment.