pod

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Poll is a poll interval for Pod
	Poll = 2 * time.Second
	// Timeout is a timeout for Pod operations
	Timeout = 1800 * time.Second
	// Block VolumeMode
	Block = "Block"
	// EvictionKind represents the kind of evictions object
	EvictionKind = "Eviction"
	// EvictionSubresource represents the kind of evictions object as pod's subresource
	EvictionSubresource = "pods/eviction"
)

Variables

This section is empty.

Functions

func GetPodCondition

func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)

GetPodCondition returns pod condition

func GetPodConditionFromList

func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)

GetPodConditionFromList returns pods and conditions

func GetPodReadyCondition

func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition

GetPodReadyCondition returns Pod status

func IsPodReady

func IsPodReady(pod *v1.Pod) bool

IsPodReady checks if Pod is in Ready state

func IsPodReadyConditionTrue

func IsPodReadyConditionTrue(status v1.PodStatus) bool

IsPodReadyConditionTrue returns true if Pod is in Ready state

Types

type Client

type Client struct {
	Interface v1core.PodInterface
	ClientSet kubernetes.Interface
	Config    *restclient.Config
	Namespace string
	Timeout   int
	// contains filtered or unexported fields
}

Client contains node client information

func (*Client) Create

func (c *Client) Create(ctx context.Context, pod *v1.Pod) *Pod

Create creates a new Pod

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, pod *v1.Pod) *Pod

Delete deletes the specified pod

func (*Client) DeleteAll

func (c *Client) DeleteAll(ctx context.Context) error

DeleteAll deletes all the pods

func (*Client) DeleteOrEvictPods

func (c *Client) DeleteOrEvictPods(ctx context.Context, nodeName string, gracePeriodSeconds int) error

DeleteOrEvictPods deletes or evicts pod from a node

func (*Client) EvictPod

func (c *Client) EvictPod(ctx context.Context, pod corev1.Pod, policyGroupVersion string, gracePeriodSeconds int) error

EvictPod evicts pod from a node

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, pod *v1.Pod, command []string, stdout, stderr io.Writer, quiet bool) error

Exec runs the pod

func (*Client) MakeEphemeralPod

func (c *Client) MakeEphemeralPod(config *Config) *v1.Pod

MakeEphemeralPod creates an ephemeral pod

func (*Client) MakePod

func (c *Client) MakePod(config *Config) *v1.Pod

MakePod creates pod

func (*Client) MakePodFromYaml

func (c *Client) MakePodFromYaml(_ string) *v1.Pod

MakePodFromYaml creates pod from yaml manifest

func (*Client) ReadyPodsCount

func (c *Client) ReadyPodsCount(ctx context.Context) (int, error)

ReadyPodsCount returns the number of Pods in Ready state

func (*Client) Update

func (c *Client) Update(_ *v1.Pod)

Update updates a pod, to be implemented

func (*Client) WaitForAllToBeReady

func (c *Client) WaitForAllToBeReady(ctx context.Context) error

WaitForAllToBeReady waits for all Pods to be in Ready state

type Config

type Config struct {
	Name            string
	NamePrefix      string
	VolumeName      string
	VolumeMode      string
	MountPath       string
	ContainerName   string
	ContainerImage  string
	PvcNames        []string
	Command         []string
	Args            []string
	Capabilities    []v1.Capability
	Annotations     map[string]string
	EnvVars         []v1.EnvVar
	CSIVolumeSource v1.CSIVolumeSource
	ReadOnlyFlag    bool
}

Config contains volume configuration parameters

type DefaultRemoteExecutor

type DefaultRemoteExecutor struct{}

DefaultRemoteExecutor represents default remote executor

func (*DefaultRemoteExecutor) Execute

func (*DefaultRemoteExecutor) Execute(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error

Execute executes remote command

type Pod

type Pod struct {
	Client  *Client
	Object  *v1.Pod
	Deleted bool
	// contains filtered or unexported fields
}

Pod contains pod related information

func (*Pod) GetError

func (pod *Pod) GetError() error

GetError returns pod error

func (*Pod) HasError

func (pod *Pod) HasError() bool

HasError checks whether pod has any error

func (*Pod) IsInPendingState

func (pod *Pod) IsInPendingState(ctx context.Context) error

IsInPendingState checks whether a pod is in Pending state

func (*Pod) Sync

func (pod *Pod) Sync(ctx context.Context) *Pod

Sync waits until Pods in expected state

func (*Pod) WaitForRunning

func (pod *Pod) WaitForRunning(ctx context.Context) error

WaitForRunning stalls until pod is ready

func (*Pod) WaitUntilGone

func (pod *Pod) WaitUntilGone(ctx context.Context) error

WaitUntilGone stalls until said Pod no longer can be found in Kubernetes

Jump to

Keyboard shortcuts

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