Documentation
¶
Index ¶
- func BuildPVCManifest(namespace, name, size, storageClass string, labels map[string]string, ...) ([]byte, error)
- func BuildPodManifest(namespace, name string, labels map[string]string, ...) ([]byte, error)
- func InjectPreStopForTarget(spec *corev1.PodSpec, preStop string, targetContainer string)
- func PreparePodSpec(podSpec corev1.PodSpec, volumes []corev1.Volume, ...) (corev1.PodSpec, error)
- func PreparePodSpecForTarget(podSpec corev1.PodSpec, volumes []corev1.Volume, ...) (corev1.PodSpec, error)
- type Client
- func (c *Client) AnnotatePod(ctx context.Context, namespace, pod, key, value string) error
- func (c *Client) Apply(ctx context.Context, namespace string, manifest []byte) error
- func (c *Client) CopyDirFromPod(ctx context.Context, namespace, pod, container, remoteDir, localDir string) error
- func (c *Client) CopyDirFromPodWithProgress(ctx context.Context, namespace, pod, container, remoteDir, localDir string, ...) error
- func (c *Client) CopyDirToPod(ctx context.Context, namespace, pod, container, localDir, remoteDir string) error
- func (c *Client) CopyDirToPodWithProgress(ctx context.Context, namespace, pod, container, localDir, remoteDir string, ...) error
- func (c *Client) CopyFromPod(ctx context.Context, namespace, podName, remotePath, localPath string) error
- func (c *Client) CopyFromPodInContainer(ctx context.Context, ...) error
- func (c *Client) CopyFromPodInContainerWithProgress(ctx context.Context, ...) error
- func (c *Client) CopyToPod(ctx context.Context, namespace, localPath, podName, remotePath string) error
- func (c *Client) CopyToPodInContainer(ctx context.Context, ...) error
- func (c *Client) CopyToPodInContainerWithProgress(ctx context.Context, ...) error
- func (c *Client) Delete(ctx context.Context, namespace string, kind string, name string, ...) error
- func (c *Client) DeleteByRef(ctx context.Context, namespace string, apiVersion string, kind string, ...) error
- func (c *Client) DescribePod(ctx context.Context, namespace, pod string) (string, error)
- func (c *Client) ExecInteractive(ctx context.Context, namespace, pod string, tty bool, command []string, ...) error
- func (c *Client) ExecInteractiveInContainer(ctx context.Context, namespace, pod, container string, tty bool, ...) error
- func (c *Client) ExecSh(ctx context.Context, namespace, pod string, script string) ([]byte, error)
- func (c *Client) ExecShInContainer(ctx context.Context, namespace, pod, container, script string) ([]byte, error)
- func (c *Client) ExtractTarToPod(ctx context.Context, namespace, podName, remoteDir string, tarStream io.Reader) error
- func (c *Client) GetContainerRestartInfo(ctx context.Context, namespace, pod, container string) (*ContainerRestartInfo, error)
- func (c *Client) GetPodAnnotation(ctx context.Context, namespace, pod, key string) (string, error)
- func (c *Client) GetPodSummary(ctx context.Context, namespace, name string) (*PodSummary, error)
- func (c *Client) GetResourceAnnotation(ctx context.Context, namespace, apiVersion, kind, name, key string) (string, bool, error)
- func (c *Client) IsRemoteDir(ctx context.Context, namespace, pod, container, remotePath string) (bool, error)
- func (c *Client) ListPods(ctx context.Context, namespace string, allNamespaces bool, ...) ([]PodSummary, error)
- func (c *Client) ListResources(ctx context.Context, namespace string, allNamespaces bool, apiVersion string, ...) ([]ResourceSummary, error)
- func (c *Client) PersistentVolumeClaimExists(ctx context.Context, namespace, name string) (bool, error)
- func (c *Client) PodContainerNames(ctx context.Context, namespace, pod string) ([]string, error)
- func (c *Client) PortForward(ctx context.Context, namespace, pod string, forwards []string, ...) error
- func (c *Client) ResourceExists(ctx context.Context, namespace string, apiVersion string, kind string, ...) (bool, error)
- func (c *Client) StreamFromPod(ctx context.Context, namespace, podName, script string, stdout io.Writer) error
- func (c *Client) StreamPodLogs(ctx context.Context, namespace, pod string, opts LogStreamOptions, ...) error
- func (c *Client) StreamShInContainer(ctx context.Context, namespace, pod, container, script string, ...) error
- func (c *Client) TouchPodActivity(ctx context.Context, namespace, pod string) error
- func (c *Client) WaitReady(ctx context.Context, namespace, pod string, timeout time.Duration) error
- func (c *Client) WaitReadyWithProgress(ctx context.Context, namespace, pod string, timeout time.Duration, ...) error
- func (c *Client) WatchPodEvents(ctx context.Context, namespace, pod string, ...)
- type ContainerRestartInfo
- type CopyProgress
- type LogStreamOptions
- type PodReadinessProgress
- type PodSummary
- type ResourceSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPVCManifest ¶
func BuildPodManifest ¶
func InjectPreStopForTarget ¶ added in v0.6.0
func PreparePodSpec ¶
Types ¶
type Client ¶
type Client struct {
Context string
// contains filtered or unexported fields
}
func (*Client) AnnotatePod ¶ added in v0.2.0
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) CopyDirFromPodWithProgress ¶ added in v0.7.3
func (c *Client) CopyDirFromPodWithProgress(ctx context.Context, namespace, pod, container, remoteDir, localDir string, prog CopyProgress) error
CopyDirFromPodWithProgress streams a remote directory as a tar archive and extracts it locally. prog.OnBytes counts post-decompression bytes (the amount actually extracted into the local destination).
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) CopyDirToPodWithProgress ¶ added in v0.7.3
func (c *Client) CopyDirToPodWithProgress(ctx context.Context, namespace, pod, container, localDir, remoteDir string, prog CopyProgress) error
CopyDirToPodWithProgress archives a local directory and extracts it into remoteDir on the pod. prog.OnBytes counts uncompressed tar bytes sent; prog.OnFile fires once per regular file packed into the archive.
func (*Client) CopyFromPod ¶
func (*Client) CopyFromPodInContainer ¶ added in v0.7.0
func (*Client) CopyFromPodInContainerWithProgress ¶ added in v0.7.3
func (c *Client) CopyFromPodInContainerWithProgress(ctx context.Context, namespace, podName, container, remotePath, localPath string, prog CopyProgress) error
CopyFromPodInContainerWithProgress streams a single remote file to localPath. Bytes reported via prog.OnBytes are post-decompression (i.e., the actual file size received locally), not wire bytes.
func (*Client) CopyToPodInContainer ¶ added in v0.3.0
func (*Client) CopyToPodInContainerWithProgress ¶ added in v0.7.3
func (c *Client) CopyToPodInContainerWithProgress(ctx context.Context, namespace, localPath, podName, container, remotePath string, prog CopyProgress) error
CopyToPodInContainerWithProgress copies a single local file to remotePath in the given pod/container. It optionally reports progress via prog.
func (*Client) DeleteByRef ¶ added in v0.3.0
func (*Client) DescribePod ¶
func (*Client) ExecInteractive ¶
func (*Client) ExecInteractiveInContainer ¶ added in v0.7.0
func (*Client) ExecShInContainer ¶
func (*Client) ExtractTarToPod ¶
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 (*Client) GetPodSummary ¶
func (*Client) GetResourceAnnotation ¶ added in v0.4.2
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) ListResources ¶ added in v0.7.3
func (*Client) PersistentVolumeClaimExists ¶ added in v0.2.6
func (*Client) PodContainerNames ¶ added in v0.3.0
func (*Client) PortForward ¶
func (*Client) ResourceExists ¶ added in v0.3.0
func (*Client) StreamFromPod ¶
func (*Client) StreamPodLogs ¶ added in v0.3.0
func (*Client) StreamShInContainer ¶ added in v0.2.11
func (*Client) TouchPodActivity ¶
func (*Client) WaitReadyWithProgress ¶
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 CopyProgress ¶ added in v0.7.3
type CopyProgress struct {
// OnBytes is invoked with the number of bytes transferred since the last
// call. For uploads this counts bytes read from the local source; for
// downloads it counts post-decompression bytes the local side receives.
OnBytes func(int64)
// OnFile is invoked once per regular file packed into a directory upload
// archive. It is not invoked for downloads or single-file copies.
OnFile func()
}
CopyProgress carries optional callbacks invoked as data flows through a Copy* operation. All fields are nil-safe.