kube

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPVCManifest

func BuildPVCManifest(namespace, name, size, storageClass string, labels map[string]string, annotations map[string]string) ([]byte, error)

func BuildPodManifest

func BuildPodManifest(namespace, name string, labels map[string]string, annotations map[string]string, podSpec corev1.PodSpec) ([]byte, error)

func InjectPreStopForTarget added in v0.6.0

func InjectPreStopForTarget(spec *corev1.PodSpec, preStop string, targetContainer string)

func PreparePodSpec

func PreparePodSpec(podSpec corev1.PodSpec, volumes []corev1.Volume, workspaceMountPath, sidecarImage string, sidecarResources corev1.ResourceRequirements, tmux bool, preStop string) (corev1.PodSpec, error)

func PreparePodSpecForTarget added in v0.3.0

func PreparePodSpecForTarget(podSpec corev1.PodSpec, volumes []corev1.Volume, workspaceMountPath, sidecarImage string, sidecarResources corev1.ResourceRequirements, tmux bool, preStop string, targetContainer string) (corev1.PodSpec, error)

Types

type Client

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

func (*Client) AnnotatePod added in v0.2.0

func (c *Client) AnnotatePod(ctx context.Context, namespace, pod, key, value string) error

func (*Client) Apply

func (c *Client) Apply(ctx context.Context, namespace string, manifest []byte) error

func (*Client) CopyDirFromPod added in v0.7.0

func (c *Client) CopyDirFromPod(ctx context.Context, namespace, pod, container, remoteDir, localDir string) error

CopyDirFromPod streams a remote directory as a tar archive and extracts it locally.

func (*Client) CopyDirToPod added in v0.7.0

func (c *Client) CopyDirToPod(ctx context.Context, namespace, pod, container, localDir, remoteDir string) error

CopyDirToPod archives a local directory and extracts it into remoteDir on the pod.

func (*Client) CopyFromPod

func (c *Client) CopyFromPod(ctx context.Context, namespace, podName, remotePath, localPath string) error

func (*Client) CopyFromPodInContainer added in v0.7.0

func (c *Client) CopyFromPodInContainer(ctx context.Context, namespace, podName, container, remotePath, localPath string) error

func (*Client) CopyToPod

func (c *Client) CopyToPod(ctx context.Context, namespace, localPath, podName, remotePath string) error

func (*Client) CopyToPodInContainer added in v0.3.0

func (c *Client) CopyToPodInContainer(ctx context.Context, namespace, localPath, podName, container, remotePath string) error

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, namespace string, kind string, name string, ignoreNotFound bool) error

func (*Client) DeleteByRef added in v0.3.0

func (c *Client) DeleteByRef(ctx context.Context, namespace string, apiVersion string, kind string, name string, ignoreNotFound bool) error

func (*Client) DescribePod

func (c *Client) DescribePod(ctx context.Context, namespace, pod string) (string, error)

func (*Client) ExecInteractive

func (c *Client) ExecInteractive(ctx context.Context, namespace, pod string, tty bool, command []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

func (*Client) ExecInteractiveInContainer added in v0.7.0

func (c *Client) ExecInteractiveInContainer(ctx context.Context, namespace, pod, container string, tty bool, command []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

func (*Client) ExecSh

func (c *Client) ExecSh(ctx context.Context, namespace, pod string, script string) ([]byte, error)

func (*Client) ExecShInContainer

func (c *Client) ExecShInContainer(ctx context.Context, namespace, pod, container, script string) ([]byte, error)

func (*Client) ExtractTarToPod

func (c *Client) ExtractTarToPod(ctx context.Context, namespace, podName, remoteDir string, tarStream io.Reader) error

func (*Client) GetContainerRestartInfo added in v0.7.0

func (c *Client) GetContainerRestartInfo(ctx context.Context, namespace, pod, container string) (*ContainerRestartInfo, error)

GetContainerRestartInfo returns restart information for a specific container in a pod. Returns nil if the container is not found.

func (*Client) GetPodAnnotation added in v0.2.0

func (c *Client) GetPodAnnotation(ctx context.Context, namespace, pod, key string) (string, error)

func (*Client) GetPodSummary

func (c *Client) GetPodSummary(ctx context.Context, namespace, name string) (*PodSummary, error)

func (*Client) GetResourceAnnotation added in v0.4.2

func (c *Client) GetResourceAnnotation(ctx context.Context, namespace, apiVersion, kind, name, key string) (string, bool, error)

func (*Client) IsRemoteDir added in v0.7.0

func (c *Client) IsRemoteDir(ctx context.Context, namespace, pod, container, remotePath string) (bool, error)

IsRemoteDir probes whether remotePath is a directory on the pod.

func (*Client) ListPods

func (c *Client) ListPods(ctx context.Context, namespace string, allNamespaces bool, labelSelector string) ([]PodSummary, error)

func (*Client) PersistentVolumeClaimExists added in v0.2.6

func (c *Client) PersistentVolumeClaimExists(ctx context.Context, namespace, name string) (bool, error)

func (*Client) PodContainerNames added in v0.3.0

func (c *Client) PodContainerNames(ctx context.Context, namespace, pod string) ([]string, error)

func (*Client) PortForward

func (c *Client) PortForward(ctx context.Context, namespace, pod string, forwards []string, stdout io.Writer, stderr io.Writer) error

func (*Client) ResourceExists added in v0.3.0

func (c *Client) ResourceExists(ctx context.Context, namespace string, apiVersion string, kind string, name string) (bool, error)

func (*Client) StreamFromPod

func (c *Client) StreamFromPod(ctx context.Context, namespace, podName, script string, stdout io.Writer) error

func (*Client) StreamPodLogs added in v0.3.0

func (c *Client) StreamPodLogs(ctx context.Context, namespace, pod string, opts LogStreamOptions, stdout io.Writer) error

func (*Client) StreamShInContainer added in v0.2.11

func (c *Client) StreamShInContainer(ctx context.Context, namespace, pod, container, script string, stdout, stderr io.Writer) error

func (*Client) TouchPodActivity

func (c *Client) TouchPodActivity(ctx context.Context, namespace, pod string) error

func (*Client) WaitReady

func (c *Client) WaitReady(ctx context.Context, namespace, pod string, timeout time.Duration) error

func (*Client) WaitReadyWithProgress

func (c *Client) WaitReadyWithProgress(ctx context.Context, namespace, pod string, timeout time.Duration, onProgress func(PodReadinessProgress)) error

func (*Client) WatchPodEvents added in v0.3.1

func (c *Client) WatchPodEvents(ctx context.Context, namespace, pod string, onEvent func(reason, message string))

WatchPodEvents watches Kubernetes events for the given pod and calls onEvent for each relevant event. It blocks until the context is cancelled. Only events with reasons in the allowlist are forwarded.

type ContainerRestartInfo added in v0.7.0

type ContainerRestartInfo struct {
	RestartCount   int32
	LastExitCode   int32
	LastReason     string // e.g. "OOMKilled", "Error"
	LastMessage    string
	CurrentWaiting string // e.g. "CrashLoopBackOff"
}

ContainerRestartInfo holds restart details for a single container.

type LogStreamOptions added in v0.3.0

type LogStreamOptions struct {
	Container string
	Follow    bool
	Previous  bool
	TailLines *int64
	Since     time.Duration
}

type PodReadinessProgress

type PodReadinessProgress struct {
	Phase           corev1.PodPhase
	ReadyContainers int
	TotalContainers int
	Reason          string
}

type PodSummary

type PodSummary struct {
	Namespace   string
	Name        string
	Phase       string
	Deleting    bool
	CreatedAt   time.Time
	Labels      map[string]string
	Annotations map[string]string
	Ready       string
	Restarts    int32
	Reason      string
	PodIP       string
}

Jump to

Keyboard shortcuts

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