Trendyol / kubectl-view-webhook

:eyes: :bangbang: This projects aims to visualize critical parts of the admission webhook configuration resource

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can not parse cli args

mstrYoda opened this issue · comments

For example when I pass --kubeconfig it can not processed by plugin

@Dentrax, I think we are parsing the kubeconfig correctly but in this code, we are sending the wrong arguments to the function, we must send CLI args to the function instead of OS arguments:

func (o *ViewWebhookOptions) Run() error {
	p := printer.NewPrinter(o.Out)

	// create the ClientSet from restConfig
	clientSet, err := kubernetes.NewForConfig(o.restConfig)
	if err != nil {
		return err
	}

	//validatingWebhookClient := clientset.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations()

	mw := k8s.NewWebHookClient(clientSet)
	model, err := mw.Run(os.Args) --> this step , must be o.Args not os.Args

	if err != nil {
		return err
	}

	p.Print(model)

	return nil
}

This bug fixed at v0.0.23, thanks @mstrYoda 👍