exec

package
v0.3.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 7 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KubectlApply added in v0.3.4

func KubectlApply(ctx context.Context, kubeconfigPath string, resources []byte) error

TODO: Remove this usage of kubectl and replace with a function from apply.go using the controller-runtime client.

func KubectlApplyWithArgs added in v0.3.7

func KubectlApplyWithArgs(ctx context.Context, kubeconfigPath string, resources []byte, args ...string) error

func KubectlWait added in v0.3.4

func KubectlWait(ctx context.Context, kubeconfigPath string, args ...string) error

Types

type Command

type Command struct {
	Cmd   string
	Args  []string
	Stdin io.Reader
}

Command wraps exec.Command with specific functionality. This differentiates itself from the standard library by always collecting stdout and stderr. Command improves the UX of exec.Command for our specific use case.

func NewCommand

func NewCommand(opts ...Option) *Command

NewCommand returns a configured Command.

func (*Command) Run

func (c *Command) Run(ctx context.Context) ([]byte, []byte, error)

Run executes the command and returns stdout, stderr and the error if there is any.

type Option

type Option func(*Command)

Option is a functional option type that modifies a Command.

func WithArgs

func WithArgs(args ...string) Option

WithArgs sets the arguments for the command such as `get pods -n kube-system` to the command `kubectl`.

func WithCommand

func WithCommand(command string) Option

WithCommand defines the command to run such as `kubectl` or `kind`.

func WithStdin

func WithStdin(stdin io.Reader) Option

WithStdin sets up the command to read from this io.Reader.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL