Documentation
¶
Index ¶
- func LogFailedContainers(ctx context.Context, c clientset.Interface, ns string, ...)
- func RunKubectl(namespace string, args ...string) (string, error)
- func RunKubectlInput(namespace string, data string, args ...string) (string, error)
- func RunKubectlOrDie(namespace string, args ...string) string
- func RunKubectlOrDieInput(namespace string, data string, args ...string) string
- func RunKubectlWithFullOutput(namespace string, args ...string) (string, string, error)
- func RunKubemciCmd(args ...string) (string, error)
- func RunKubemciWithKubeconfig(args ...string) (string, error)
- type KubectlBuilder
- func (b *KubectlBuilder) AppendEnv(env []string) *KubectlBuilder
- func (b KubectlBuilder) Exec() (string, error)
- func (b KubectlBuilder) ExecOrDie(namespace string) string
- func (b KubectlBuilder) ExecWithFullOutput() (string, string, error)
- func (b KubectlBuilder) WithStdinData(data string) *KubectlBuilder
- func (b KubectlBuilder) WithStdinReader(reader io.Reader) *KubectlBuilder
- func (b *KubectlBuilder) WithTimeout(t <-chan time.Time) *KubectlBuilder
- type TestKubeconfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogFailedContainers ¶
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 ¶
RunKubectl is a convenience wrapper over kubectlBuilder
func RunKubectlInput ¶
RunKubectlInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubectlOrDie ¶
RunKubectlOrDie is a convenience wrapper over kubectlBuilder
func RunKubectlOrDieInput ¶
RunKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubectlWithFullOutput ¶
RunKubectlWithFullOutput is a convenience wrapper over kubectlBuilder It will also return the command's stderr.
func RunKubemciCmd ¶
RunKubemciCmd is a convenience wrapper over kubectlBuilder to run kubemci. It assumes that kubemci exists in PATH.
func RunKubemciWithKubeconfig ¶
RunKubemciWithKubeconfig is a convenience wrapper over RunKubemciCmd
Types ¶
type KubectlBuilder ¶
type KubectlBuilder struct {
// contains filtered or unexported fields
}
KubectlBuilder is used to build, customize and execute a kubectl Command. Add more functions to customize the builder as needed.
func NewKubectlCommand ¶
func NewKubectlCommand(namespace string, args ...string) *KubectlBuilder
NewKubectlCommand returns a KubectlBuilder for running kubectl.
func (*KubectlBuilder) AppendEnv ¶
func (b *KubectlBuilder) AppendEnv(env []string) *KubectlBuilder
AppendEnv appends the given environment and returns itself.
func (KubectlBuilder) Exec ¶
func (b KubectlBuilder) Exec() (string, error)
Exec runs the kubectl executable.
func (KubectlBuilder) ExecOrDie ¶
func (b KubectlBuilder) ExecOrDie(namespace string) string
ExecOrDie runs the kubectl executable or dies if error occurs.
func (KubectlBuilder) ExecWithFullOutput ¶
func (b KubectlBuilder) ExecWithFullOutput() (string, string, error)
ExecWithFullOutput runs the kubectl executable, and returns the stdout and stderr.
func (KubectlBuilder) WithStdinData ¶
func (b KubectlBuilder) WithStdinData(data string) *KubectlBuilder
WithStdinData sets the given data to stdin and returns itself.
func (KubectlBuilder) WithStdinReader ¶
func (b KubectlBuilder) WithStdinReader(reader io.Reader) *KubectlBuilder
WithStdinReader sets the given reader and returns itself.
func (*KubectlBuilder) WithTimeout ¶
func (b *KubectlBuilder) WithTimeout(t <-chan time.Time) *KubectlBuilder
WithTimeout sets the given timeout and returns itself.
type TestKubeconfig ¶
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 }
TestKubeconfig is a struct containing the needed attributes from TestContext and Framework(Namespace).
func NewTestKubeconfig ¶
func NewTestKubeconfig(certdir, host, kubeconfig, kubecontext, kubectlpath, namespace string) *TestKubeconfig
NewTestKubeconfig returns a new Kubeconfig struct instance.
func (*TestKubeconfig) KubectlCmd ¶
func (tk *TestKubeconfig) KubectlCmd(args ...string) *exec.Cmd
KubectlCmd runs the kubectl executable through the wrapper script.
func (*TestKubeconfig) ReadFileViaContainer ¶
func (tk *TestKubeconfig) ReadFileViaContainer(podName, containerName string, path string) (string, error)
ReadFileViaContainer reads a file using kubectl exec cat <path>.
func (*TestKubeconfig) WriteFileViaContainer ¶
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