kubectl

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoContainerFound = fmt.Errorf("no container found")
View Source
var (
	ErrNotFound = errors.New("not found")
)

Definitions of common error types used throughout runtime implementation. All errors returned by the interface will map into one of these errors classes.

View Source
var ErrPodCompleted = fmt.Errorf("pod ran to completion")
View Source
var ErrPodStarted = fmt.Errorf("pod ran to running")

Functions

func ContainerRunning

func ContainerRunning(containerName string) func(watch.Event) (bool, error)

ContainerRunning returns true if the pod is running and container is ready, false if the pod has not yet reached those states, returns ErrPodCompleted if the pod has run to completion, or an error in any other case.

func ErrWithMessagef

func ErrWithMessagef(err error, format string, args ...interface{}) error

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the error is due to a missing resource

func PodInitReady

func PodInitReady(event watch.Event) (bool, error)

PodInitReady returns true if the pod init containers are running and ready, false if the pod has not yet reached those states, returns ErrPodCompleted if the pod has run to completion, or an error in any other case.

func PreparePortForward

func PreparePortForward(config *rest.Config, namespace, podName string, ports []string, stopChannel, readyChannel chan struct{}, out, errOut io.Writer) (*portforward.PortForwarder, error)

func SetKubernetesDefaults

func SetKubernetesDefaults(config *rest.Config) error

SetKubernetesDefaults sets default values on the provided client config for accessing the Kubernetes API or returns an error if any of the defaults are impossible or invalid. NOTE: Originally copied from here:

https://github.com/kubernetes/kubernetes/blob/ddf47ac13c1a9483ea035a79cd7c10005ff21a6d/pkg/kubectl/cmd/util/kubectl_match_version.go#L113-L130

Types

type Client

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

func NewClient

func NewClient(config *rest.Config) *Client

func (*Client) Attach

func (c *Client) Attach(namespace, podName, containerName string, stdin io.Reader, stdout, stderr io.Writer, tty bool) error

func (*Client) CreatePod

func (c *Client) CreatePod(namespace, name, image string, cmd []string, workDir string, tty, stdin bool, publicKey []byte, scvAccName string, nodeSelectors map[string]string) (*apiv1.Pod, error)

func (*Client) DeletePod

func (c *Client) DeletePod(namespace, name string) error

func (*Client) GetLogs

func (c *Client) GetLogs(namespace, name, containerName string) (*rest.Request, error)

func (*Client) WaitForPod

func (c *Client) WaitForPod(namespace, name string, exitCondition watchtools.ConditionFunc) (*apiv1.Pod, error)

WaitForPod watches the given pod until the exitCondition is true

Jump to

Keyboard shortcuts

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