Documentation ¶
Index ¶
- Constants
- func CopyArchive(c KubernetesClientInterface, containerID, sourcePath, destPath string) error
- func GetContainerID(container *v1.ContainerStatus) string
- func KillGracefully(c KubernetesClientInterface, containerID string) error
- func TerminatePodWithContainerID(c KubernetesClientInterface, containerID string, sig syscall.Signal) error
- func WaitForTermination(c KubernetesClientInterface, containerID string, timeout time.Duration) error
- type KubernetesClientInterface
Constants ¶
View Source
const KillGracePeriod = 10
killGracePeriod is the time in seconds after sending SIGTERM before forcefully killing the sidecar with SIGKILL (value matches k8s)
Variables ¶
This section is empty.
Functions ¶
func CopyArchive ¶
func CopyArchive(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(c KubernetesClientInterface, containerID string) error
KillGracefully kills a container gracefully.
func TerminatePodWithContainerID ¶
func TerminatePodWithContainerID(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(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(containerID string) (*v1.Pod, *v1.ContainerStatus, error) KillContainer(pod *v1.Pod, container *v1.ContainerStatus, sig syscall.Signal) error CreateArchive(containerID, sourcePath string) (*bytes.Buffer, error) }
KubernetesClientInterface is the interface to implement getContainerStatus method
Click to show internal directories.
Click to hide internal directories.