zeropod

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NodeLabel                        = "zeropod.ctrox.dev/node"
	PortsAnnotationKey               = "zeropod.ctrox.dev/ports-map"
	ContainerNamesAnnotationKey      = "zeropod.ctrox.dev/container-names"
	ScaleDownDurationAnnotationKey   = "zeropod.ctrox.dev/scaledown-duration"
	DisableCheckpoiningAnnotationKey = "zeropod.ctrox.dev/disable-checkpointing"
	PreDumpAnnotationKey             = "zeropod.ctrox.dev/pre-dump"
	CRIContainerNameAnnotation       = "io.kubernetes.cri.container-name"
	CRIContainerTypeAnnotation       = "io.kubernetes.cri.container-type"
)
View Source
const (
	LabelPodName      = "pod"
	LabelPodNamespace = "namespace"

	MetricsNamespace         = "zeropod"
	MetricCheckPointDuration = "checkpoint_duration_seconds"
	MetricRestoreDuration    = "restore_duration_seconds"
	MetricLastCheckpointTime = "last_checkpoint_time"
	MetricLastRestoreTime    = "last_restore_time"
	MetricRunning            = "running"
)
View Source
const RuntimeName = "io.containerd.zeropod.v2"

Variables

View Source
var ErrAlreadyRestored = errors.New("container is already restored")

Functions

func GetNetworkNS

func GetNetworkNS(spec *specs.Spec) (string, error)

GetNetworkNS reads the bundle's OCI spec and returns the network NS path of the container.

func GetPIDNS added in v0.0.2

func GetPIDNS(spec *specs.Spec) (string, error)

GetPIDNS reads the bundle's OCI spec and returns the PID NS path of the container.

func GetSpec

func GetSpec(bundlePath string) (*specs.Spec, error)

func NewRegistry added in v0.3.0

func NewRegistry() *prometheus.Registry

Types

type Config

type Config struct {
	ZeropodContainerNames []string
	Ports                 []uint16
	ScaleDownDuration     time.Duration
	DisableCheckpointing  bool
	PreDump               bool
	ContainerName         string
	ContainerType         string
	PodName               string
	PodNamespace          string
	PodUID                string
	ContainerdNamespace   string
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(ctx context.Context, spec *specs.Spec) (*Config, error)

NewConfig uses the annotations from the container spec to create a new typed ZeropodConfig config.

func (Config) IsZeropodContainer added in v0.0.2

func (cfg Config) IsZeropodContainer() bool

type Container

type Container struct {
	*runc.Container
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, cfg *Config, cr *sync.Mutex, container *runc.Container, pt stdio.Platform, events chan *v1.ContainerStatus) (*Container, error)

func (*Container) AddCheckpointedPID added in v0.4.1

func (c *Container) AddCheckpointedPID(pid int)

AddCheckpointedPID registers a new pid that should be considered checkpointed.

func (*Container) CancelScaleDown

func (c *Container) CancelScaleDown()

func (*Container) CheckpointedPID added in v0.4.1

func (c *Container) CheckpointedPID(pid int) bool

CheckpointedPID indicates if the pid has been checkpointed before.

func (*Container) DeleteCheckpointedPID added in v0.4.1

func (c *Container) DeleteCheckpointedPID(pid int)

DeleteCheckpointedPID deletes a pid from the map of checkpointed pids.

func (*Container) ID

func (c *Container) ID() string

func (*Container) InitialProcess

func (c *Container) InitialProcess() process.Process

func (*Container) Process

func (c *Container) Process() process.Process

func (*Container) RegisterPostRestore added in v0.2.0

func (c *Container) RegisterPostRestore(f func(*runc.Container, HandleStartedFunc))

func (*Container) RegisterPreRestore added in v0.2.0

func (c *Container) RegisterPreRestore(f func() HandleStartedFunc)

func (*Container) Restore

func (c *Container) Restore(ctx context.Context) (*runc.Container, process.Process, error)

func (*Container) ScaledDown

func (c *Container) ScaledDown() bool

func (*Container) ScheduleScaleDown

func (c *Container) ScheduleScaleDown() error

func (*Container) SetScaledDown

func (c *Container) SetScaledDown(scaledDown bool)

func (*Container) Status added in v0.3.0

func (c *Container) Status() *v1.ContainerStatus

func (*Container) Stop

func (c *Container) Stop(ctx context.Context)

func (*Container) StopActivator

func (c *Container) StopActivator(ctx context.Context)

type HandleStartedFunc added in v0.2.0

type HandleStartedFunc func(*runc.Container, process.Process)

Jump to

Keyboard shortcuts

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