zeropod

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 35 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 MetricsSocketPath = "/run/zeropod/s/"
View Source
const RuntimeName = "io.containerd.zeropod.v2"

Variables

This section is empty.

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 ListeningPorts added in v0.0.2

func ListeningPorts(pid int) ([]uint16, error)

ListeningPorts finds all ports of the pid that are in listen state of the supplied process. It finds both, ipv4 and ipv6 sockets.

func StartMetricsServer added in v0.2.0

func StartMetricsServer(ctx context.Context, containerID string)

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
	// 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) (*Container, error)

func (*Container) CancelScaleDown

func (c *Container) CancelScaleDown()

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) 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, bool)

Jump to

Keyboard shortcuts

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