Documentation ¶
Index ¶
- Variables
- func CopyFromContainer(ctx context.Context, i cri.Interface, c *cri.Container, ...) (string, error)
- func CopyFromContainerByMount(ctx context.Context, i cri.Interface, c *cri.Container, ...) error
- func CopyFromContainerByTar(ctx context.Context, i cri.Interface, c *cri.Container, ...) error
- func CopyFromContainerToTempFile(ctx context.Context, i cri.Interface, c *cri.Container, path string) (string, func() error, error)
- func CopySmallFileFromContainerToTempFile(ctx context.Context, i cri.Interface, c *cri.Container, path string) (string, func() error, error)
- func CopyToContainer(ctx context.Context, i cri.Interface, c *cri.Container, ...) (string, error)
- func CopyToContainerByChunk(ctx context.Context, i cri.Interface, c *cri.Container, ...) error
- func CopyToContainerByMount(ctx context.Context, i cri.Interface, c *cri.Container, ...) (retErr error)
- func CopyToContainerByTar(ctx context.Context, i cri.Interface, c *cri.Container, ...) (retErr error)
- func CountZombies(i cri.Interface, ctx context.Context, c *cri.Container) (int, error)
- func ExecChmod(ctx context.Context, i cri.Interface, c *cri.Container, path string, ...) error
- func ExecCp(ctx context.Context, i cri.Interface, c *cri.Container, ...) error
- func ExecMv(ctx context.Context, i cri.Interface, c *cri.Container, ...) error
- func ExecRm(ctx context.Context, i cri.Interface, c *cri.Container, path string) error
- func FindFirstPodByIp(i cri.Interface, ip string) *cri.Pod
- func FindPodsByIp(i cri.Interface, ip string) []*cri.Pod
- func GetContainerE(i cri.Interface, ns, pod, k8sContainerName string) (*cri.Container, error)
- func GetMainBizContainerE(i cri.Interface, ns string, pod string) (*cri.Container, error)
- func Glob(ctx context.Context, i cri.Interface, c *cri.Container, pattern string) ([]string, error)
- func HasCommand(ctx context.Context, i cri.Interface, c *cri.Container, command string) error
- func Md5sum(ctx context.Context, i cri.Interface, c *cri.Container, path string) (string, error)
- func ReadContainerFile(ctx context.Context, i cri.Interface, c *cri.Container, path string) ([]byte, error)
- func ReadContainerFileUsingExecCat(ctx context.Context, i cri.Interface, c *cri.Container, path string) ([]byte, error)
- func SubContextTimeoutExec(parent context.Context, timeout time.Duration, ...) (cri.ExecResult, error)
- func TcpProxy(ctx context.Context, i cri.Interface, c *cri.Container, addr string, ...) (net.Conn, error)
- func TcpProxyByExec(ctx context.Context, i cri.Interface, c *cri.Container, addr string) (net.Conn, error)
- type ProcessInfo
- type StatefulHelper
- type StatelessHelper
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupported = errors.New("unsupported") ErrDisabled = errors.New("disabled") )
Functions ¶
func CopyFromContainer ¶
func CopyFromContainerByTar ¶
func CopyFromContainerByTar(ctx context.Context, i cri.Interface, c *cri.Container, srcPath, dstPath string) error
CopyFromContainerByTar copies file from container using tar
func CopyFromContainerToTempFile ¶
func CopyFromContainerToTempFile(ctx context.Context, i cri.Interface, c *cri.Container, path string) (string, func() error, error)
CopyFromContainerToTempFile copies file from container to local tep file. It is the caller's responsibility to remove the file when it is no longer needed. See os.CreateTemp.
func CopySmallFileFromContainerToTempFile ¶
func CopySmallFileFromContainerToTempFile(ctx context.Context, i cri.Interface, c *cri.Container, path string) (string, func() error, error)
CopySmallFileFromContainerToTempFile copies small file from container to temp file.
func CopyToContainer ¶
func CopyToContainerByChunk ¶
func CopyToContainerByMount ¶
func CopyToContainerByTar ¶
func CopyToContainerByTar(ctx context.Context, i cri.Interface, c *cri.Container, srcPath, dstPath string) (retErr error)
CopyToContainerByTar copies file to container using tar
func CountZombies ¶
func ExecChmod ¶
func ExecChmod(ctx context.Context, i cri.Interface, c *cri.Container, path string, mode fs.FileMode) error
ExecChmod executes 'chmod' command inside container
func GetContainerE ¶
func GetMainBizContainerE ¶
GetMainBizContainerE get main biz container for pod
func HasCommand ¶
HasCommand checks whether container has specified command
func ReadContainerFile ¶
func ReadContainerFile(ctx context.Context, i cri.Interface, c *cri.Container, path string) ([]byte, error)
ReadContainerFile copies file from container to local temp file, reads the file content, and then remove the temp file.
func ReadContainerFileUsingExecCat ¶
func ReadContainerFileUsingExecCat(ctx context.Context, i cri.Interface, c *cri.Container, path string) ([]byte, error)
ReadContainerFileUsingExecCat reads container file using docker exec 'cat ...'
func SubContextTimeoutExec ¶
Types ¶
type ProcessInfo ¶
type StatefulHelper ¶
type StatefulHelper interface { // 打开一个文件用于后续读操作, 要返回一个句柄, 并且对端(必须长期运行)必须要持有文件句柄不关闭 FileOpen(c *cri.Container, path string) (interface{}, error) FileSeek(c *cri.Container, fd interface{}) (interface{}, error) FileRead(c *cri.Container, fd interface{}) (interface{}, error) FileRead2(c *cri.Container, fd interface{}, offset, limit int) (interface{}, error) FileStat(c *cri.Container, fd interface{}) (interface{}, error) FileClose(c *cri.Container, fd interface{}) (interface{}, error) }