native

package
v0.0.0-...-8fd29ad Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbPath        = "data"
	ImagePath     = "images"
	ContainerPath = "containers"
)
View Source
const ImageLatestSuffix = ":LATEST"
View Source
const PodPrefix = "pod://"
View Source
const STDOUT = "STDOUT"

Variables

This section is empty.

Functions

func AddSubscribe

func AddSubscribe(ch chan ProcessEvent)

func ExistDir

func ExistDir(dirname string) bool

判断目录是否存在

func ImageLatest

func ImageLatest(image string) bool

func UnTar

func UnTar(src string, dest string) error

Types

type BaseProcessEvent

type BaseProcessEvent struct {
	// contains filtered or unexported fields
}

type ContainerProcess

type ContainerProcess struct {
	Workdir string `json:"workdir"`

	PodName   string           `json:"pod_name"`
	Namespace string           `json:"namespace"`
	Container corev1.Container `json:"container"`

	Sync          bool                 `json:"sync"`
	RestartPolicy corev1.RestartPolicy `json:"restart_policy"`

	//状态信息
	Pid               int  `json:"pid"`
	ImagePulled       bool `json:"image_pulled"`
	ImageUnzipped     bool `json:"image_unzipped"`
	ConfigMapDownload bool `json:"config_map_download"`
	SecretDownload    bool `json:"secret_download"`
	// contains filtered or unexported fields
}

序列化tag

func NewProcess

func NewProcess(pod *corev1.Pod, c corev1.Container, workdir string, im *ImageManager, pm *ProcessManager, sync bool) *ContainerProcess

type ContainerProcessFinish

type ContainerProcessFinish struct {
	ProcessEvent
	// contains filtered or unexported fields
}

type ContainerProcessRun

type ContainerProcessRun struct {
	ProcessEvent
	// contains filtered or unexported fields
}

type DownloadResource

type DownloadResource struct {
	BaseProcessEvent
}

type ImageManager

type ImageManager struct {
	// contains filtered or unexported fields
}

func NewImageManager

func NewImageManager(imagePath string, db *bitcask.Bitcask, max int) *ImageManager

func (*ImageManager) PullImage

func (m *ImageManager) PullImage(parentCtx context.Context, opts PullImageOpts) error

func (*ImageManager) UnzipImage

func (m *ImageManager) UnzipImage(ctx context.Context, image string, workdir string) error

type ImagePulling

type ImagePulling struct {
	// contains filtered or unexported fields
}

func NewImagePulling

func NewImagePulling(imageName string) *ImagePulling

type NodeEventHandler

type NodeEventHandler struct {
	// contains filtered or unexported fields
}

type PodEventHandler

type PodEventHandler struct {
	HostIp string
	// contains filtered or unexported fields
}

func (*PodEventHandler) OnContainerRun

func (p *PodEventHandler) OnContainerRun(event ContainerProcessRun, pod *v1.Pod)

func (*PodEventHandler) OnDownloadResource

func (p *PodEventHandler) OnDownloadResource(event DownloadResource, pod *v1.Pod)

func (*PodEventHandler) OnFinish

func (p *PodEventHandler) OnFinish(event ContainerProcessFinish, pod *v1.Pod)

func (*PodEventHandler) OnPodStart

func (p *PodEventHandler) OnPodStart(event PodProcessStart, pod *v1.Pod)

type PodProcess

type PodProcess struct {
	Workdir   string `json:"workdir"`
	PodName   string `json:"pod_name"`
	Namespace string `json:"namespace"`

	ProcessChain []*ContainerProcess `json:"process_chain"`
	Pod          *corev1.Pod         `json:"pod"`

	Index int `json:"index"`
	// contains filtered or unexported fields
}

func (*PodProcess) Key

func (p *PodProcess) Key() []byte

type PodProcessStart

type PodProcessStart struct {
	ProcessEvent
	// contains filtered or unexported fields
}

type ProcessEvent

type ProcessEvent interface {
	// contains filtered or unexported methods
}

type ProcessManager

type ProcessManager struct {
	// contains filtered or unexported fields
}

func NewProcessManager

func NewProcessManager(workdir string, processDb *bitcask.Bitcask, im *ImageManager, record record.EventRecorder, nodeIp string, manager *manager.ResourceManager) *ProcessManager

func (*ProcessManager) Delete

func (m *ProcessManager) Delete(store ProcessStore) error

func (*ProcessManager) DeletePod

func (m *ProcessManager) DeletePod(ctx context.Context, pod *corev1.Pod) error

func (*ProcessManager) Get

func (m *ProcessManager) Get(key []byte) (*PodProcess, error)

func (*ProcessManager) Put

func (m *ProcessManager) Put(store ProcessStore) error

func (*ProcessManager) RunPod

func (m *ProcessManager) RunPod(ctx context.Context, p *corev1.Pod) error

func (*ProcessManager) Start

func (m *ProcessManager) Start(ctx context.Context) error

func (*ProcessManager) UpdatePod

func (m *ProcessManager) UpdatePod(pod *corev1.Pod) error

type ProcessStore

type ProcessStore interface {
	Key() []byte
}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(ctx context.Context, cfg provider.InitConfig) (*Provider, error)

func (*Provider) ConfigureNode

func (p *Provider) ConfigureNode(ctx context.Context, node *v1.Node)

func (*Provider) CreatePod

func (p *Provider) CreatePod(ctx context.Context, pod *v1.Pod) error

func (*Provider) DeletePod

func (p *Provider) DeletePod(ctx context.Context, pod *v1.Pod) error

func (*Provider) GetContainerLogs

func (p *Provider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)

func (*Provider) GetPod

func (p *Provider) GetPod(ctx context.Context, namespace, name string) (*v1.Pod, error)

func (*Provider) GetPodStatus

func (p *Provider) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)

func (*Provider) GetPods

func (p *Provider) GetPods(ctx context.Context) ([]*v1.Pod, error)

func (*Provider) GetStatsSummary

func (p *Provider) GetStatsSummary(ctx context.Context) (*stats.Summary, error)

func (*Provider) NotifyNodeStatus

func (p *Provider) NotifyNodeStatus(ctx context.Context, f func(*v1.Node))

func (*Provider) NotifyPods

func (p *Provider) NotifyPods(ctx context.Context, f func(*v1.Pod))

func (*Provider) Ping

func (p *Provider) Ping(ctx context.Context) error

func (*Provider) RunInContainer

func (p *Provider) RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, attach api.AttachIO) error

func (*Provider) UpdatePod

func (p *Provider) UpdatePod(ctx context.Context, pod *v1.Pod) error

type PullImageOpts

type PullImageOpts struct {
	SrcImage string // docker://ccr.ccs.tencentyun.com/k8s-test/test:oci-test-v1

	DockerAuthConfig            *types.DockerAuthConfig
	DockerBearerRegistryToken   string
	DockerRegistryUserAgent     string
	DockerInsecureSkipTLSVerify types.OptionalBool

	Timeout    time.Duration
	RetryCount int
}

Jump to

Keyboard shortcuts

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