From df2f5998785f0f24a830b16bba801e87c7b3f495 Mon Sep 17 00:00:00 2001 From: chenk Date: Tue, 2 Apr 2024 12:06:13 +0300 Subject: [PATCH] feat: change flag name from skip-intrusive to non-intrusive Signed-off-by: chenk --- pkg/flag/kubernetes_flags.go | 14 +++++++------- pkg/k8s/commands/cluster.go | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/flag/kubernetes_flags.go b/pkg/flag/kubernetes_flags.go index 52157ad5313a..292d1586b826 100644 --- a/pkg/flag/kubernetes_flags.go +++ b/pkg/flag/kubernetes_flags.go @@ -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.", } @@ -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] @@ -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 @@ -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(), @@ -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, @@ -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(), diff --git a/pkg/k8s/commands/cluster.go b/pkg/k8s/commands/cluster.go index f585c8aaabaa..ce3df2dacdca 100644 --- a/pkg/k8s/commands/cluster.go +++ b/pkg/k8s/commands/cluster.go @@ -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),