func (tk *TestKubeconfig) KubectlCmd(args ...string) *exec.Cmd {
	defaultArgs := []string{}

	// Reference a --server option so tests can run anywhere.
	if tk.Host != "" {
		defaultArgs = append(defaultArgs, "--"+clientcmd.FlagAPIServer+"="+tk.Host)
	}
	if tk.KubeConfig != "" {
		defaultArgs = append(defaultArgs, "--"+clientcmd.RecommendedConfigPathFlag+"="+tk.KubeConfig)

		// Reference the KubeContext
		if tk.KubeContext != "" {
			defaultArgs = append(defaultArgs, "--"+clientcmd.FlagContext+"="+tk.KubeContext)
		}

	} else {
		if tk.CertDir != "" {
			defaultArgs = append(defaultArgs,
				fmt.Sprintf("--certificate-authority=%s", filepath.Join(tk.CertDir, "ca.crt")),
				fmt.Sprintf("--client-certificate=%s", filepath.Join(tk.CertDir, "kubecfg.crt")),
				fmt.Sprintf("--client-key=%s", filepath.Join(tk.CertDir, "kubecfg.key")))
		}
	}
	kubectlArgs := append(defaultArgs, args...)

	//We allow users to specify path to kubectl, so you can test either "kubectl" or "cluster/kubectl.sh"
	//and so on.
	cmd := exec.Command(tk.KubectlPath, kubectlArgs...)

	//caller will invoke this and wait on it.
	return cmd
}
// KubectlCmd runs the kubectl executable through the wrapper script.
KubectlCmd runs the kubectl executable through the wrapper script.
// KubectlCmd runs the kubectl executable through the wrapper script .
func (tk *TestKubeconfig) KubectlCmd(args ...string) *exec.Cmd {
	defaultArgs := []string{}
	if tk.Host != "" {
		defaultArgs = append(defaultArgs, "--"+clientcmd.FlagAPIServer+"="+tk.Host)
	}
	if tk.KubeConfig != "" {
		defaultArgs = append(defaultArgs, "--"+clientcmd.RecommendedConfigPathFlag+"="+tk.KubeConfig)
		if tk.KubeContext != "" {
			defaultArgs = append(defaultArgs, "--"+clientcmd.FlagContext+"="+tk.KubeContext)
		}
	} else {
		if tk.CertDir != "" {
			defaultArgs = append(defaultArgs,
				fmt.Sprintf("--certificate-authority=%s", filepath.Join(tk.CertDir, "ca.crt")),
				fmt.Sprintf("--client-certificate=%s", filepath.Join(tk.CertDir, "kubecfg.crt")),
				fmt.Sprintf("--client-key=%s", filepath.Join(tk.CertDir, "kubecfg.key")))
		}
	}
	kubectlArgs := append(defaultArgs, args...)
	cmd := exec.Command(tk.KubectlPath, kubectlArgs...)
	return cmd
}
func ( tk * TestKubeconfig ) KubectlCmd ( args ... string ) * exec . Cmd { defaultArgs := [ ] string { } if tk . Host != " " { defaultArgs = append ( defaultArgs , " " + clientcmd . FlagAPIServer + " " + tk . Host ) } if tk . KubeConfig != " " { defaultArgs = append ( defaultArgs , " " + clientcmd . RecommendedConfigPathFlag + " " + tk . KubeConfig ) if tk . KubeContext != " " { defaultArgs = append ( defaultArgs , " " + clientcmd . FlagContext + " " + tk . KubeContext ) } } else { if tk . CertDir != " " { defaultArgs = append ( defaultArgs , fmt . Sprintf ( " " , filepath . Join ( tk . CertDir , " " ) ) , fmt . Sprintf ( " " , filepath . Join ( tk . CertDir , " " ) ) , fmt . Sprintf ( " " , filepath . Join ( tk . CertDir , " " ) ) ) } } kubectlArgs := append ( defaultArgs , args ... ) cmd := exec . Command ( tk . KubectlPath , kubectlArgs ... ) return cmd }
KubectlCmd runs the kubectl executable through the wrapper script.
KubectlCmd runs the kubectl executable through the wrapper script .
// Reference a --server option so tests can run anywhere. // Reference the KubeContext //We allow users to specify path to kubectl, so you can test either "kubectl" or "cluster/kubectl.sh" //and so on. //caller will invoke this and wait on it.