// Init instantiates a Kubernetes client and rest configuration for the forwarding client.
Init instantiates a Kubernetes client and rest configuration for the forwarding client.
// Init instantiates a Kubernetes client and rest configuration for the forwarding client .
func (c *Client) Init(getter genericclioptions.RESTClientGetter, version string) error {
	userAgent := fmt.Sprintf("kubectl-exec-forward/%s", version)
	getter = userAgentGetter{
		RESTClientGetter: getter,
		userAgent:        userAgent,
	}
	c.AttachablePodForObjectFn = attachablepod.New(getter).Get
	ns, _, err := getter.ToRawKubeConfigLoader().Namespace()
	if err != nil {
		return err
	}
	c.Namespace = ns
	rc, err := getter.ToRESTConfig()
	if err != nil {
		return err
	}
	c.restConfig = rc
	cs, err := kubernetes.NewForConfig(rc)
	if err != nil {
		return err
	}
	c.clientset = cs
	return nil
}
func ( c * Client ) Init ( getter genericclioptions . RESTClientGetter , version string ) error { userAgent := fmt . Sprintf ( " " , version ) getter = userAgentGetter { RESTClientGetter : getter , userAgent : userAgent , } c . AttachablePodForObjectFn = attachablepod . New ( getter ) . Get ns , _ , err := getter . ToRawKubeConfigLoader ( ) . Namespace ( ) if err != nil { return err } c . Namespace = ns rc , err := getter . ToRESTConfig ( ) if err != nil { return err } c . restConfig = rc cs , err := kubernetes . NewForConfig ( rc ) if err != nil { return err } c . clientset = cs return nil }
Init instantiates a Kubernetes client and rest configuration for the forwarding client.
Init instantiates a Kubernetes client and rest configuration for the forwarding client .