Skip to content

Commit

Permalink
feat: support exclude/include kinds/namespaces
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <[email protected]>
  • Loading branch information
chen-keinan committed Apr 8, 2024
1 parent 661de0d commit 6951afe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
13 changes: 0 additions & 13 deletions pkg/flag/kubernetes_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ import (
)

var (
ClusterContextFlag = Flag[string]{
Name: "context",
ConfigName: "kubernetes.context",
Usage: "specify a context to scan",
Aliases: []Alias{
{Name: "ctx"},
},
}
KubeConfigFlag = Flag[string]{
Name: "kubeconfig",
ConfigName: "kubernetes.kubeconfig",
Expand Down Expand Up @@ -104,7 +96,6 @@ var (
)

type K8sFlagGroup struct {
ClusterContext *Flag[string]
KubeConfig *Flag[string]
Components *Flag[[]string]
K8sVersion *Flag[string]
Expand All @@ -122,7 +113,6 @@ type K8sFlagGroup struct {
}

type K8sOptions struct {
ClusterContext string
KubeConfig string
Components []string
K8sVersion string
Expand All @@ -141,7 +131,6 @@ type K8sOptions struct {

func NewK8sFlagGroup() *K8sFlagGroup {
return &K8sFlagGroup{
ClusterContext: ClusterContextFlag.Clone(),
KubeConfig: KubeConfigFlag.Clone(),
Components: ComponentsFlag.Clone(),
K8sVersion: K8sVersionFlag.Clone(),
Expand All @@ -165,7 +154,6 @@ func (f *K8sFlagGroup) Name() string {

func (f *K8sFlagGroup) Flags() []Flagger {
return []Flagger{
f.ClusterContext,
f.KubeConfig,
f.Components,
f.K8sVersion,
Expand Down Expand Up @@ -210,7 +198,6 @@ func (f *K8sFlagGroup) ToOptions() (K8sOptions, error) {
}

return K8sOptions{
ClusterContext: f.ClusterContext.Value(),
KubeConfig: f.KubeConfig.Value(),
Components: f.Components.Value(),
K8sVersion: f.K8sVersion.Value(),
Expand Down
2 changes: 0 additions & 2 deletions pkg/k8s/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ import (
// Run runs a k8s scan
func Run(ctx context.Context, args []string, opts flag.Options) error {
clusterOptions := []k8s.ClusterOption{
k8s.WithContext(opts.K8sOptions.ClusterContext),
k8s.WithKubeConfig(opts.K8sOptions.KubeConfig),
k8s.WithBurst(opts.K8sOptions.Burst),
k8s.WithQPS(opts.K8sOptions.QPS),
k8s.WithContext(opts.K8sOptions.ClusterContext),
}
if len(args) > 0 {
clusterOptions = append(clusterOptions, k8s.WithContext(args[0]))
Expand Down

0 comments on commit 6951afe

Please sign in to comment.