Documentation ¶
Index ¶
- func AreAllPodsRunning(podPrefix, namespace string) (bool, error)
- func AreAllPodsSucceeded(podPrefix, namespace string) (bool, bool, error)
- func RunCommandMultipleTimes(podRunnerCmd podRunnerCmd, image, name, command string, desiredAttempts int, ...) (int, error)
- func WaitOnReady(podPrefix, namespace string, successesNeeded int, ...) (bool, error)
- func WaitOnSucceeded(podPrefix, namespace string, sleep, duration time.Duration) (bool, error)
- type Container
- type ContainerState
- type ContainerStatus
- type EnvVar
- type Limits
- type List
- type Metadata
- type Pod
- func CreatePodFromFile(filename, name, namespace string, sleep, duration time.Duration) (*Pod, error)
- func Get(podName, namespace string) (*Pod, error)
- func GetAllByPrefix(prefix, namespace string) ([]Pod, error)
- func GetTerminated(podName, namespace string) (*Pod, error)
- func GetWithRetry(podPrefix, namespace string, sleep, duration time.Duration) (*Pod, error)
- func RunLinuxPod(image, name, namespace, command string, printOutput bool, ...) (*Pod, error)
- func RunWindowsPod(image, name, namespace, command string, printOutput bool, ...) (*Pod, error)
- func (p *Pod) CheckLinuxOutboundConnection(sleep, duration time.Duration) (bool, error)
- func (p *Pod) CheckWindowsOutboundConnection(url string, sleep, duration time.Duration) (bool, error)
- func (p *Pod) Delete(retries int) error
- func (p *Pod) Exec(c ...string) ([]byte, error)
- func (p *Pod) ValidateAzureFile(mountPath string, sleep, duration time.Duration) (bool, error)
- func (p *Pod) ValidateCurlConnection(uri string, sleep, duration time.Duration) (bool, error)
- func (p *Pod) ValidateHostPort(check string, attempts int, sleep time.Duration, master, sshKeyPath string) bool
- func (p *Pod) ValidateOmsAgentLogs(execCmdString string, sleep, duration time.Duration) (bool, error)
- func (p *Pod) ValidatePVC(mountPath string, sleep, duration time.Duration) (bool, error)
- func (p *Pod) WaitOnReady(sleep, duration time.Duration) (bool, error)
- func (p *Pod) WaitOnSucceeded(sleep, duration time.Duration) (bool, error)
- type Port
- type Requests
- type Resources
- type Spec
- type Status
- type TerminatedContainerState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreAllPodsRunning ¶
AreAllPodsRunning will return true if all pods in a given namespace are in a Running State
func AreAllPodsSucceeded ¶ added in v0.21.0
AreAllPodsSucceeded returns true, false if all pods in a given namespace are in a Running State returns false, true if any one pod is in a Failed state
func RunCommandMultipleTimes ¶ added in v0.23.0
func RunCommandMultipleTimes(podRunnerCmd podRunnerCmd, image, name, command string, desiredAttempts int, sleep, duration time.Duration) (int, error)
RunCommandMultipleTimes runs the same command 'desiredAttempts' times
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
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 ContainerState ¶ added in v0.21.0
type ContainerState struct {
Terminated TerminatedContainerState `json:"terminated"`
}
ContainerState has state of a container
type ContainerStatus ¶ added in v0.19.0
type ContainerStatus struct { ContainerID string `json:"containerID"` Image string `json:"image"` ImageID string `json:"imageID"` Name string `json:"name"` Ready bool `json:"ready"` RestartCount int `json:"restartCount"` State ContainerState `json:"state"` LastState ContainerState `json:"lastState"` }
ContainerStatus has status of a container
type List ¶
type List struct {
Pods []Pod `json:"items"`
}
List is a container that holds all pods returned from doing a kubectl get pods
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, sleep, duration time.Duration) (*Pod, error)
CreatePodFromFile will create a Pod from file with a name
func GetAllByPrefix ¶ added in v0.8.0
GetAllByPrefix will return all pods in a given namespace that match a prefix
func GetTerminated ¶ added in v0.21.0
GetTerminated will return a pod with a given name and namespace, including terminated pods
func GetWithRetry ¶ added in v0.25.0
GetWithRetry gets a pod, allowing for retries
func RunLinuxPod ¶ added in v0.21.0
func RunLinuxPod(image, name, namespace, command string, printOutput bool, sleep, duration time.Duration) (*Pod, error)
RunLinuxPod will create a pod that runs a bash command --overrides := `"spec": {"nodeSelector":{"beta.kubernetes.io/os":"windows"}}}`
func RunWindowsPod ¶ added in v0.23.0
func RunWindowsPod(image, name, namespace, command string, printOutput bool, sleep, duration time.Duration) (*Pod, error)
RunWindowsPod will create a pod that runs a powershell command --overrides := `"spec": {"nodeSelector":{"beta.kubernetes.io/os":"windows"}}}`
func (*Pod) CheckLinuxOutboundConnection ¶ added in v0.8.0
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(url string, 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) ValidateAzureFile ¶ added in v0.10.0
ValidateAzureFile will keep retrying the check if azure file is mounted in Pod
func (*Pod) ValidateCurlConnection ¶ added in v0.14.0
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) ValidateOmsAgentLogs ¶ added in v0.21.0
func (p *Pod) ValidateOmsAgentLogs(execCmdString string, sleep, duration time.Duration) (bool, error)
ValidateOmsAgentLogs validates omsagent logs
func (*Pod) ValidatePVC ¶ added in v0.22.0
ValidatePVC will keep retrying the check if azure disk is mounted in Pod
func (*Pod) WaitOnReady ¶ added in v0.10.0
WaitOnReady will call the static method WaitOnReady passing in p.Metadata.Name and p.Metadata.Namespace
type Status ¶
type Status struct { HostIP string `json:"hostIP"` Phase string `json:"phase"` PodIP string `json:"podIP"` StartTime time.Time `json:"startTime"` ContainerStatuses []ContainerStatus `json:"containerStatuses"` }
Status holds information like hostIP and phase
type TerminatedContainerState ¶ added in v0.21.0
type TerminatedContainerState struct { ContainerID string `json:"containerID"` ExitCode int `json:"exitCode"` FinishedAt string `json:"finishedAt"` Reason string `json:"reason"` StartedAt string `json:"startedAt"` }
TerminatedContainerState shows terminated state of a container