pod

package
v0.16.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: MIT Imports: 11 Imported by: 46

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreAllPodsRunning

func AreAllPodsRunning(podPrefix, namespace string) (bool, error)

AreAllPodsRunning will return true if all pods in a given namespace are in a Running State

func WaitOnReady

func WaitOnReady(podPrefix, namespace string, successesNeeded int, sleep, duration time.Duration) (bool, error)

WaitOnReady is used when you dont have a handle on a pod but want to wait until its in a Ready state. successesNeeded is used to make sure we return the correct value even if the pod is in a CrashLoop

Types

type Container added in v0.9.4

type Container struct {
	Image     string    `json:"image"`
	Ports     []Port    `json:"ports"`
	Env       []EnvVar  `json:"env"`
	Resources Resources `json:"resources"`
}

Container holds information like image and ports

func (*Container) GetEnvironmentVariable added in v0.13.0

func (c *Container) GetEnvironmentVariable(varName string) (string, error)

GetEnvironmentVariable returns an environment variable value from a container within a pod

func (*Container) ValidateResources added in v0.14.0

func (c *Container) ValidateResources(a api.KubernetesContainerSpec) error

ValidateResources checks that an addon has the expected memory/cpu limits and requests

type EnvVar added in v0.13.0

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

EnvVar holds environment variables

type Limits added in v0.14.0

type Limits struct {
	CPU    string `json:"cpu"`
	Memory string `json:"memory"`
}

Limits represents container resource limits

type List

type List struct {
	Pods []Pod `json:"items"`
}

List is a container that holds all pods returned from doing a kubectl get pods

func GetAll

func GetAll(namespace string) (*List, error)

GetAll will return all pods in a given namespace

type Metadata

type Metadata struct {
	CreatedAt time.Time         `json:"creationTimestamp"`
	Labels    map[string]string `json:"labels"`
	Name      string            `json:"name"`
	Namespace string            `json:"namespace"`
}

Metadata holds information like name, createdat, labels, and namespace

type Pod

type Pod struct {
	Metadata Metadata `json:"metadata"`
	Spec     Spec     `json:"spec"`
	Status   Status   `json:"status"`
}

Pod is used to parse data from kubectl get pods

func CreatePodFromFile added in v0.10.0

func CreatePodFromFile(filename, name, namespace string) (*Pod, error)

CreatePodFromFile will create a Pod from file with a name

func Get

func Get(podName, namespace string) (*Pod, error)

Get will return a pod with a given name and namespace

func GetAllByPrefix added in v0.8.0

func GetAllByPrefix(prefix, namespace string) ([]Pod, error)

GetAllByPrefix will return all pods in a given namespace that match a prefix

func (*Pod) CheckLinuxOutboundConnection added in v0.8.0

func (p *Pod) CheckLinuxOutboundConnection(sleep, duration time.Duration) (bool, error)

CheckLinuxOutboundConnection will keep retrying the check if an error is received until the timeout occurs or it passes. This helps us when DNS may not be available for some time after a pod starts.

func (*Pod) CheckWindowsOutboundConnection added in v0.8.0

func (p *Pod) CheckWindowsOutboundConnection(sleep, duration time.Duration) (bool, error)

CheckWindowsOutboundConnection will keep retrying the check if an error is received until the timeout occurs or it passes. This helps us when DNS may not be available for some time after a pod starts.

func (*Pod) Delete added in v0.10.0

func (p *Pod) Delete() error

Delete will delete a Pod in a given namespace

func (*Pod) Exec added in v0.8.0

func (p *Pod) Exec(c ...string) ([]byte, error)

Exec will execute the given command in the pod

func (*Pod) ValidateAzureFile added in v0.10.0

func (p *Pod) ValidateAzureFile(mountPath string, sleep, duration time.Duration) (bool, error)

ValidateAzureFile will keep retrying the check if azure file is mounted in Pod

func (*Pod) ValidateCurlConnection added in v0.14.0

func (p *Pod) ValidateCurlConnection(uri string, sleep, duration time.Duration) (bool, error)

ValidateCurlConnection connects to a URI on TCP 80

func (*Pod) ValidateHostPort added in v0.9.4

func (p *Pod) ValidateHostPort(check string, attempts int, sleep time.Duration, master, sshKeyPath string) bool

ValidateHostPort will attempt to run curl against the POD's hostIP and hostPort

func (*Pod) WaitOnReady added in v0.10.0

func (p *Pod) WaitOnReady(sleep, duration time.Duration) (bool, error)

WaitOnReady will call the static method WaitOnReady passing in p.Metadata.Name and p.Metadata.Namespace

type Port added in v0.9.4

type Port struct {
	ContainerPort int `json:"containerPort"`
	HostPort      int `json:"hostPort"`
}

Port represents a container port definition

type Requests added in v0.14.0

type Requests struct {
	CPU    string `json:"cpu"`
	Memory string `json:"memory"`
}

Requests represents container resource requests

type Resources added in v0.14.0

type Resources struct {
	Requests Requests `json:"requests"`
	Limits   Limits   `json:"limits"`
}

Resources represents a container resources definition

type Spec added in v0.9.4

type Spec struct {
	Containers []Container `json:"containers"`
}

Spec holds information like containers

type Status

type Status struct {
	HostIP    string    `json:"hostIP"`
	Phase     string    `json:"phase"`
	PodIP     string    `json:"podIP"`
	StartTime time.Time `json:"startTime"`
}

Status holds information like hostIP and phase

Jump to

Keyboard shortcuts

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