common

package
v3.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyArchive

func CopyArchive(ctx context.Context, c KubernetesClientInterface, containerID, sourcePath, destPath string) error

CopyArchive downloads files and directories as a tarball and saves it to a specified path.

func GetContainerID

func GetContainerID(container *v1.ContainerStatus) string

GetContainerID returns container ID of a ContainerStatus resource

func KillGracefully

func KillGracefully(ctx context.Context, c KubernetesClientInterface, containerID string, terminationGracePeriodDuration time.Duration) error

KillGracefully kills a container gracefully.

func TerminatePodWithContainerID

func TerminatePodWithContainerID(ctx context.Context, c KubernetesClientInterface, containerID string, sig syscall.Signal) error

TerminatePodWithContainerID invoke the given SIG against the PID1 of the container. No-op if the container is on the hostPID

func WaitForTermination

func WaitForTermination(ctx context.Context, c KubernetesClientInterface, containerID string, timeout time.Duration) error

WaitForTermination of the given containerID, set the timeout to 0 to discard it

Types

type KubernetesClientInterface

type KubernetesClientInterface interface {
	GetContainerStatus(ctx context.Context, containerID string) (*v1.Pod, *v1.ContainerStatus, error)
	KillContainer(pod *v1.Pod, container *v1.ContainerStatus, sig syscall.Signal) error
	CreateArchive(ctx context.Context, containerID, sourcePath string) (*bytes.Buffer, error)
}

KubernetesClientInterface is the interface to implement getContainerStatus method

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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