podtool

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeTar

func MakeTar(srcPath, destPath string, writer io.Writer) error

Types

type ActionType

type ActionType string
const Download ActionType = "Download"
const Exec ActionType = "Exec"

type ExecConfig

type ExecConfig struct {
	Command    []string
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	Tty        bool
	NoPreserve bool
}

type File

type File struct {
	Name      string `json:"name"`
	Size      string `json:"size"`
	Mode      string `json:"mode"`
	IsDir     bool   `json:"isDir"`
	ModTime   string `json:"modTime"`
	User      string `json:"user"`
	UserGroup string `json:"group"`
	Link      string `json:"link"`
	Path      string `json:"path"`
}

type PodTool

type PodTool struct {
	Namespace     string
	PodName       string
	ContainerName string
	K8sClient     *kubernetes.Clientset
	RestClient    *rest.Config
	ExecConfig    ExecConfig
}

func (*PodTool) CatFile

func (p *PodTool) CatFile(filePath string) ([]byte, error)

func (*PodTool) CopyFromPod

func (p *PodTool) CopyFromPod(filePath string, destPath string) error

func (*PodTool) CopyToContainer

func (p *PodTool) CopyToContainer(destPath string) error

func (*PodTool) CopyToPod

func (p *PodTool) CopyToPod(srcPath, destPath string) error

func (*PodTool) EditFile

func (p *PodTool) EditFile(path string, content string) error

func (*PodTool) Exec

func (p *PodTool) Exec(actionType ActionType) error

Exec 在给定容器中执行命令

func (*PodTool) ExecCommand

func (p *PodTool) ExecCommand(commands []string) ([]byte, error)

func (*PodTool) ListFiles

func (p *PodTool) ListFiles(path string) ([]File, error)

Jump to

Keyboard shortcuts

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