pod

package
v0.0.0-...-30877e0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CGROUP_PATH_SYSFS = "/sys/fs/cgroup"
)

Variables

This section is empty.

Functions

func EnsureContainerSystemCpuDir

func EnsureContainerSystemCpuDir(cpuDir string, cpuCount int64) error

func EnsureDir

func EnsureDir(dir string) error

func EnsureFile

func EnsureFile(filename string, content string, mod string) error

func GetDefaultMaskedPaths

func GetDefaultMaskedPaths(unmasks apis.ContainerProcMountType) []string

func GetReadonlyPaths

func GetReadonlyPaths(unmasks apis.ContainerProcMountType) []string

Types

type CRI

type CRI interface {
	Version(ctx context.Context) (*runtimeapi.VersionResponse, error)
	ListPods(ctx context.Context, opts ListPodOptions) ([]*runtimeapi.PodSandbox, error)
	RunPod(ctx context.Context, podConfig *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
	StopPod(ctx context.Context, req *runtimeapi.StopPodSandboxRequest) error
	RemovePod(ctx context.Context, podId string) error
	CreateContainer(ctx context.Context, podId string, podConfig *runtimeapi.PodSandboxConfig, ctrConfig *runtimeapi.ContainerConfig, withPull bool) (string, error)
	StartContainer(ctx context.Context, id string) error
	StopContainer(ctx context.Context, ctrId string, timeout int64, tryRemove bool, force bool) error
	RemoveContainer(ctx context.Context, ctrId string) error
	RunContainers(ctx context.Context, podConfig *runtimeapi.PodSandboxConfig, containerConfigs []*runtimeapi.ContainerConfig, runtimeHandler string) (*RunContainersResponse, error)
	ListContainers(ctx context.Context, opts ListContainerOptions) ([]*runtimeapi.Container, error)
	ContainerStatus(ctx context.Context, ctrId string) (*runtimeapi.ContainerStatusResponse, error)
	ListImages(ctx context.Context, filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error)
	PullImage(ctx context.Context, req *runtimeapi.PullImageRequest) (*runtimeapi.PullImageResponse, error)
	ImageStatus(ctx context.Context, req *runtimeapi.ImageStatusRequest) (*runtimeapi.ImageStatusResponse, error)

	// lower layer client
	GetImageClient() runtimeapi.ImageServiceClient
	GetRuntimeClient() runtimeapi.RuntimeServiceClient
}

func NewCRI

func NewCRI(endpoint string, timeout time.Duration) (CRI, error)

type CgroupUtil

type CgroupUtil interface {
	SetMemoryLimitBytes(ctrId string, bytes int64) error
	SetCPUCfs(ctrId string, quota int64, period int64) error
	SetDevicesAllow(ctrId string, allows []string) error
	SetPidsMax(ctrId string, max int) error
	SetCpusetCloneChildren(ctrId string) error
}

func NewPodCgroupV1Util

func NewPodCgroupV1Util(parentPath string) CgroupUtil

type ContainerCPU

type ContainerCPU struct {
	ContainerId string `json:"container_id"`
	Index       int    `json:"index"`
}

func NewContainerCPU

func NewContainerCPU(ctrId string, ctrIdx int) *ContainerCPU

type HostContainerCPU

type HostContainerCPU struct {
	Index      int                        `json:"index"`
	Containers map[string][]*ContainerCPU `json:"containers"`
}

func NewHostContainerCPU

func NewHostContainerCPU(hostIndex int) *HostContainerCPU

func (*HostContainerCPU) DeleteContainer

func (h *HostContainerCPU) DeleteContainer(ctrId string)

func (*HostContainerCPU) HasContainer

func (h *HostContainerCPU) HasContainer(ctrId string) bool

func (*HostContainerCPU) InsertContainer

func (h *HostContainerCPU) InsertContainer(ctrId string, ctrIdx int)

type HostContainerCPUMap

type HostContainerCPUMap struct {
	Map map[string]*HostContainerCPU `json:"map"`
	// contains filtered or unexported fields
}

func NewHostContainerCPUMap

func NewHostContainerCPUMap(topo *hostapi.HostTopology, stateFile string) (*HostContainerCPUMap, error)

func (*HostContainerCPUMap) Delete

func (hm *HostContainerCPUMap) Delete(ctrId string) error

func (*HostContainerCPUMap) Get

func (hm *HostContainerCPUMap) Get(ctrId string, ctrCpuIndex int) (int, error)

type ListContainerOptions

type ListContainerOptions struct {
	// Id of container
	Id string
	// PodId of container
	PodId string
	// Regular expression pattern to match pod or container
	NameRegexp string
	// Regular expression pattern to match the pod namespace
	PodNamespaceRegexp string
	// State of the sandbox
	State string
	// Show verbose info for the sandbox
	Verbose bool
	// Labels are selectors for the sandbox
	Labels map[string]string
	// Image ued by the container
	Image string
}

type ListPodOptions

type ListPodOptions struct {
	Id    string
	State string
}

type RunContainersResponse

type RunContainersResponse struct {
	PodId        string   `json:"pod_id"`
	ContainerIds []string `json:"container_ids"`
}

Directories

Path Synopsis
cp

Jump to

Keyboard shortcuts

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