unikontainers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyAnnotations = errors.New("spec annotations are empty")
View Source
var Log = logrus.WithField("subsystem", "unikontainers")

Functions

func IsBimaContainer

func IsBimaContainer(bundle string) bool

isBimaContainer attempts to find any bima related annotations in the given bundle to verify the image is compatible with urunc

func SendIPCMessage

func SendIPCMessage(socketAddress string, message IPCMessage) error

SendIPCMessage creates a new connection to socketAddress, sends the message and closes the connection

func SockAddrExists

func SockAddrExists(sockAddr string) bool

sockAddrExists returns true if if given sock address exists returns false if any error is encountered

Types

type IPCMessage

type IPCMessage string
const (
	ReexecStarted IPCMessage = "BOOTED"
	AckReexec     IPCMessage = "ACK"
	StartExecve   IPCMessage = "START"
)

type RootFs

type RootFs struct {
	Path      string             // The path of the root file system.
	IsBlock   bool               // Indicates if it's a block device.
	BlkDevice disk.PartitionStat // Information about the block device.
}

RootFs represents a root file system and its properties.

type UnikernelConfig

type UnikernelConfig struct {
	UnikernelType   string `json:"com.urunc.unikernel.unikernelType"`
	UnikernelCmd    string `json:"com.urunc.unikernel.cmdline,omitempty"`
	UnikernelBinary string `json:"com.urunc.unikernel.binary"`
	Hypervisor      string `json:"com.urunc.unikernel.hypervisor"`
}

A UnikernelConfig struct holds the info provided by bima image on how to execute our unikernel

func GetUnikernelConfig

func GetUnikernelConfig(bundleDir string, spec *specs.Spec) (*UnikernelConfig, error)

GetUnikernelConfig tries to get the Unikernel config from the bundle annotations. If that fails, it gets the Unikernel config from the urunc.json file inside the rootfs. FIXME: custom annotations are unreachable, we nned to investigate why to skip adding the urunc.json file For more details, see: https://github.com/nubificus/urunc/issues/12

func (*UnikernelConfig) Map

func (c *UnikernelConfig) Map() map[string]string

Map returns a map containing the Unikernel config data

type Unikontainer

type Unikontainer struct {
	State   *specs.State
	Spec    *specs.Spec
	BaseDir string
}

Unikontainer holds the data necessary to create, manage and delete unikernel containers

func Get

func Get(containerID string, rootDir string) (*Unikontainer, error)

Get retrieves unikernel data from disk to create a Unikontainer object

func New

func New(bundlePath string, containerID string, rootDir string) (*Unikontainer, error)

New parses the bundle and creates a new Unikontainer object

func (*Unikontainer) AwaitAckReexec

func (u *Unikontainer) AwaitAckReexec() error

AwaitAckReexec opens a new connection to UruncSock and waits for a AckReexec message

func (*Unikontainer) AwaitReexecStarted

func (u *Unikontainer) AwaitReexecStarted() error

AwaitReexecStarted opens a new connection to InitSock and waits for a ReexecStarted message

func (*Unikontainer) AwaitStartExecve

func (u *Unikontainer) AwaitStartExecve() error

AwaitStartExecve opens a new connection to UruncSock and waits for a StartExecve message

func (*Unikontainer) Create

func (u *Unikontainer) Create(pid int) error

Create sets the Unikernel status as created, and saves the given PID in init.pid

func (*Unikontainer) Delete

func (u *Unikontainer) Delete() error

Delete removes the containers base directory and its contents

func (*Unikontainer) Exec

func (u *Unikontainer) Exec() error

func (*Unikontainer) ExecuteHooks

func (u *Unikontainer) ExecuteHooks(name string) error

ExecuteHooks executes any hooks found in spec based on name:

func (*Unikontainer) InitialSetup

func (u *Unikontainer) InitialSetup() error

InitialSetup sets the Unikernel status as creating, creates the Unikernel base directory and saves the state.json file with the current Unikernel state

func (*Unikontainer) Kill

func (u *Unikontainer) Kill() error

Kill stops the VMM process, first by asking the VMM struct to stop and consequently by killing the process described in u.State.Pid

func (*Unikontainer) SendAckReexec

func (u *Unikontainer) SendAckReexec() error

SendAckReexec sends an AckReexec message to UruncSock

func (*Unikontainer) SendReexecStarted

func (u *Unikontainer) SendReexecStarted() error

SendReexecStarted sends an ReexecStarted message to InitSock

func (*Unikontainer) SendStartExecve

func (u *Unikontainer) SendStartExecve() error

SendStartExecve sends an StartExecve message to UruncSock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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