cluster-api: Index | Files

package exec

import ""


Package Files

command.go kubectl.go

func KubectlApply Uses

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 Uses

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

func KubectlWait Uses

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

type Command Uses

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 Uses

func NewCommand(opts ...Option) *Command

NewCommand returns a configured Command.

func (*Command) Run Uses

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 Uses

type Option func(*Command)

Option is a functional option type that modifies a Command.

func WithArgs Uses

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 Uses

func WithCommand(command string) Option

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

func WithStdin Uses

func WithStdin(stdin io.Reader) Option

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

Package exec imports 7 packages (graph) and is imported by 3 packages. Updated 2020-09-25. Refresh now. Tools for package owners.