kubectl

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(args ...string) ([]byte, error)

Create runs a kubectl create command with the specified arguments

func CreateFromSpec

func CreateFromSpec(spec []byte, namespace string, args ...string) ([]byte, error)

CreateFromSpec creates resources specified in the provided spec in the given namespace. Returns the output of the create command.

func Delete

func Delete(resourceType, name, namespace string) ([]byte, error)

Delete deletes the specified resourceType.

func GetNamespaces

func GetNamespaces(ctx context.Context, runner utils.CommandRunner) ([]string, error)

GetNamespaces fetches the names of all namespaces

func GetNodesAddr

func GetNodesAddr(ctx context.Context) ([]string, error)

GetNodesAddr returns internal IP addresses of all nodes in the cluster

func GetPodContainers

func GetPodContainers(ctx context.Context, namespace, pod string, runner utils.CommandRunner) ([]string, error)

GetPodContainers fetches the names of the containers from the specified pod in the given namespace

func GetPods

func GetPods(ctx context.Context, namespace string, runner utils.CommandRunner) ([]string, error)

GetPods fetches the names of the pods from the given namespace

func Run

func Run(name string, args ...string) ([]byte, error)

Run runs a kubectl command specified with args using privileged kubeconfig

func RunCommand

func RunCommand(cmd *Cmd, options ...OptionSetter) ([]byte, error)

RunCommand runs a kubectl command specified with args

Types

type Cmd

type Cmd struct {
	// contains filtered or unexported fields
}

Cmd is a kubectl command with arguments

func Command

func Command(args ...string) *Cmd

Command returns a new command that executes a kubectl command with optional args

func (Cmd) Args

func (r Cmd) Args() []string

Args returns the command line for this Cmd. Implements utils.Command

func (Cmd) String

func (r Cmd) String() string

String returns a formatted representation of this command

type OptionSetter

type OptionSetter func(*Cmd)

OptionSetter is a functional option for configuring commands

func WithPrivilegedConfig

func WithPrivilegedConfig() OptionSetter

WithPrivilegedConfig returns a command option to specify a privileged kubeconfig

Jump to

Keyboard shortcuts

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