fc

package
v0.0.0-...-e62a7ec Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// FirecrackerSockName is the name of the Firecracker VMM API socket
	FirecrackerSockName = "firecracker.sock"
	// FirecrackerLogFifoName is the name of the Firecracker VMM log FIFO
	FirecrackerLogFifoName = "fc-logs.fifo"
	// FirecrackerMetricsFifoName is the name of the Firecracker VMM metrics FIFO
	FirecrackerMetricsFifoName = "fc-metrics.fifo"
	// OsvOutputLogfileName is the name of the Osv log
	OsvOutputLogfileName = "osv.fifo"
)
View Source
const (

	// DefaultImageSuffix is the default image tag kubelet try to add to image.
	DefaultImageSuffix = ":latest"
)

Variables

View Source
var (
	ErrNotAssign = errors.New("VM setup is not assigned")
)

Functions

func DeleteTap

func DeleteTap(name string)

DeleteTap deletes the tap device with given name

func GetExecEnvironmentCount

func GetExecEnvironmentCount(labels map[string]string) int

GetExecEnvironmentCount gets the EE count

func GetMaxReplicaCount

func GetMaxReplicaCount(labels map[string]string) int

GetMaxReplicaCount gets the maximum replica count

func GetMinReplicaCount

func GetMinReplicaCount(labels map[string]string) int

GetMinReplicaCount gets the minimum replica count

func PrepareReplicaRequest

func PrepareReplicaRequest(labels map[string]string,
	envs map[string]string,
	image string) (*pb.CreateRequest, error)

PrepareReplicaRequest prepares the argument needed for creating replica

Types

type Dir

type Dir string

Dir represents the root of a firecracker-frakti VM directory, which holds various files, sockets and FIFOs used during VM runtime.

func VMDir

func VMDir(namespace, vmID string) (Dir, error)

VMDir holds files, sockets and FIFOs scoped to a single VM with the given VMID. It is unique per-VM and containerd namespace.

func (Dir) FirecrackerLogFifoPath

func (d Dir) FirecrackerLogFifoPath() string

FirecrackerLogFifoPath returns the path to the FIFO at which the firecracker VMM writes its logs

func (Dir) FirecrackerMetricsFifoPath

func (d Dir) FirecrackerMetricsFifoPath() string

FirecrackerMetricsFifoPath returns the path to the FIFO at which the firecracker VMM writes metrics

func (Dir) FirecrackerSockPath

func (d Dir) FirecrackerSockPath() string

FirecrackerSockPath returns the path to the unix socket at which the firecracker VMM services its API

func (Dir) Mkdir

func (d Dir) Mkdir() error

Mkdir will mkdir the RootPath with correct permissions, or no-op if it already exists

func (Dir) OsvOutputLogfilePath

func (d Dir) OsvOutputLogfilePath() string

OsvOutputLogfilePath returns the path to the log file at which the osv writes its logs

func (Dir) RootPath

func (d Dir) RootPath() string

RootPath returns the top-level directory of the VM dir

type ReplicaMeta

type ReplicaMeta struct {
	Machine       *firecracker.Machine
	MachineConfig firecracker.Config

	Vmid string
	// contains filtered or unexported fields
}

ReplicaMeta contains metadata of a serverless vm replica >>>> This is used by fcdaemon, not stored at the gateway/proxy

func CreateReplica

func CreateReplica(ctx context.Context, newMachineLock *sync.Mutex,
	fcBinary string, vmSetupPool *VMSetupPool, serviceState *ServiceState,
	req *pb.CreateRequest, cpuID uint32, numaNode uint32) (*ReplicaMeta, error)

CreateReplica creates a new serverless function replica

type ServiceState

type ServiceState struct {
	ResmngrAddr    string
	FcdaemonAddr   string
	NetName        string
	CachePort      uint
	UseCustomCache bool
	AvALogLevel    string
}

ServiceState contains states that are necessary to start the VM

type Tool

type Tool struct {
	FirecrackerBinary string
	Ctx               context.Context
	InetDev           string
}

Tool is a struct that contains all the meta data of the functions

func NewTool

func NewTool() (*Tool, error)

NewTool creates Tool

type TryAgainError

type TryAgainError struct {
	Msg string // description of error
}

TryAgainError contains the error message that asks the client to retry

func (*TryAgainError) Error

func (e *TryAgainError) Error() string

type VMSetup

type VMSetup struct {
	ReplicaMeta *ReplicaMeta
	// contains filtered or unexported fields
}

VMSetup contains meta data for the vm and a configured network interface using cni

type VMSetupPool

type VMSetupPool struct {
	sync.Mutex
	IdleVMSetup     []*VMSetup
	OccupiedVMSetup map[string]*VMSetup

	NetName string
	// contains filtered or unexported fields
}

VMSetupPool contains a pool of vm setup

func NewVMSetupPool

func NewVMSetupPool(ctx context.Context, netname string) *VMSetupPool

NewVMSetupPool creates a empty vm setup pool

func (*VMSetupPool) FillVMSetupPool

func (p *VMSetupPool) FillVMSetupPool(n int) error

FillVMSetupPool fills in n vm setup to idle pool

func (*VMSetupPool) GetVMSetup

func (p *VMSetupPool) GetVMSetup() (*VMSetup, error)

GetVMSetup returns a vm setup

func (*VMSetupPool) ReturnVMSetup

func (p *VMSetupPool) ReturnVMSetup(vmSetup *VMSetup)

ReturnVMSetup returns the vm setup back to the idle vm setup pool

func (*VMSetupPool) ReturnVMSetupByVmid

func (p *VMSetupPool) ReturnVMSetupByVmid(vmid string) error

ReturnVMSetupByVmid returns the vm setup identified by vmid to the idle vm setup pool

Jump to

Keyboard shortcuts

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