func LogFailedContainers(ctx context.Context, c clientset.Interface, ns string, logFunc func(ftm string, args ...interface{}))
LogFailedContainers runs `kubectl logs` on a failed containers.
func RunKubectl(namespace string, args ...string) (string, error)
RunKubectl is a convenience wrapper over kubectlBuilder
func RunKubectlInput(namespace string, data string, args ...string) (string, error)
RunKubectlInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubectlOrDie(namespace string, args ...string) string
RunKubectlOrDie is a convenience wrapper over kubectlBuilder
func RunKubectlOrDieInput(namespace string, data string, args ...string) string
RunKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubectlWithFullOutput(namespace string, args ...string) (string, string, error)
RunKubectlWithFullOutput is a convenience wrapper over kubectlBuilder It will also return the command's stderr.
func RunKubemciCmd(args ...string) (string, error)
RunKubemciCmd is a convenience wrapper over kubectlBuilder to run kubemci. It assumes that kubemci exists in PATH.
func RunKubemciWithKubeconfig(args ...string) (string, error)
RunKubemciWithKubeconfig is a convenience wrapper over RunKubemciCmd
KubectlBuilder is used to build, customize and execute a kubectl Command. Add more functions to customize the builder as needed.
type KubectlBuilder struct {
// contains filtered or unexported fields
}
func NewKubectlCommand(namespace string, args ...string) *KubectlBuilder
NewKubectlCommand returns a KubectlBuilder for running kubectl.
func (b *KubectlBuilder) AppendEnv(env []string) *KubectlBuilder
AppendEnv appends the given environment and returns itself.
func (b KubectlBuilder) Exec() (string, error)
Exec runs the kubectl executable.
func (b KubectlBuilder) ExecOrDie(namespace string) string
ExecOrDie runs the kubectl executable or dies if error occurs.
func (b KubectlBuilder) ExecWithFullOutput() (string, string, error)
ExecWithFullOutput runs the kubectl executable, and returns the stdout and stderr.
func (b KubectlBuilder) WithStdinData(data string) *KubectlBuilder
WithStdinData sets the given data to stdin and returns itself.
func (b KubectlBuilder) WithStdinReader(reader io.Reader) *KubectlBuilder
WithStdinReader sets the given reader and returns itself.
func (b *KubectlBuilder) WithTimeout(t <-chan time.Time) *KubectlBuilder
WithTimeout sets the given timeout and returns itself.
TestKubeconfig is a struct containing the needed attributes from TestContext and Framework(Namespace).
type TestKubeconfig struct { CertDir string Host string KubeConfig string KubeContext string KubectlPath string Namespace string // Every test has at least one namespace unless creation is skipped }
func NewTestKubeconfig(certdir, host, kubeconfig, kubecontext, kubectlpath, namespace string) *TestKubeconfig
NewTestKubeconfig returns a new Kubeconfig struct instance.
func (tk *TestKubeconfig) KubectlCmd(args ...string) *exec.Cmd
KubectlCmd runs the kubectl executable through the wrapper script.
func (tk *TestKubeconfig) ReadFileViaContainer(podName, containerName string, path string) (string, error)
ReadFileViaContainer reads a file using kubectl exec cat <path>.
func (tk *TestKubeconfig) WriteFileViaContainer(podName, containerName string, path string, contents string) error
WriteFileViaContainer writes a file using kubectl exec echo <contents> > <path> via specified container because of the primitive technique we're using here, we only allow ASCII alphanumeric characters