firecracker

package
v0.0.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MMDS_IP     = "169.254.169.254"
	MMDS_SUBNET = 16

	VMS_NETWORK_PREFIX = "172.26.0"
	VMS_NETWORK_SUBNET = 30
)

Variables

View Source
var DefaultOptions = NewOptions()

Functions

func BuildNetCfg

func BuildNetCfg(eth0Mac, eth1Mac, ip0, ip1 string) (string, error)

func CreateTap

func CreateTap(name, cidr string) error

sudo ip tuntap add tap0 mode tap sudo ip addr add 172.16.0.1/24 dev tap0 sudo ip link set tap0 up

func CreateTap_

func CreateTap_(name, cidr string) (netlink.Link, error)

sudo ip tuntap add tap0 mode tap sudo ip addr add 172.16.0.1/24 dev tap0 sudo ip link set tap0 up

func GetEgressInterface

func GetEgressInterface() (string, error)

func MacAddr

func MacAddr(b []byte) string

func PrepareCloudInitUserData

func PrepareCloudInitUserData(ud UserData, script string) ([]byte, error)

func SetupIPTables

func SetupIPTables(iface, tapDev string) error

Host iface bond0 detect using EGRESS_IFACE=`ip route get 8.8.8.8 |grep uid |sed 's/.* dev \([^ ]*\) .*/\1/'`

func TapDelete

func TapDelete(name string) error

sudo ip link del tap0

func TapDelete_

func TapDelete_(name string) error

func TapExists

func TapExists(name string) bool

func WorkflowRunRootFSPath

func WorkflowRunRootFSPath(uid string) string

Types

type EthernetConfig

type EthernetConfig struct {
	Match       EthernetMatcher `json:"match"`
	Addresses   []string        `json:"addresses"`
	Gateway4    string          `json:"gateway4,omitempty"`
	Nameservers *Nameservers    `json:"nameservers,omitempty"`
	Routes      []Route         `json:"routes,omitempty"`
}

type EthernetMatcher

type EthernetMatcher struct {
	Macaddress string `json:"macaddress"`
}

type Instance

type Instance struct {
	ID    int
	UID   string
	InUse bool
	// contains filtered or unexported fields
}

func (*Instance) Free

func (i *Instance) Free()

type Instances

type Instances struct {
	// contains filtered or unexported fields
}

func NewInstances

func NewInstances(numInstances int) *Instances

func (*Instances) Free

func (i *Instances) Free(id int)

func (*Instances) Next

func (i *Instances) Next() (*Instance, bool)

type LatestConfig

type LatestConfig struct {
	MetaData interface{} `json:"meta-data,omitempty"`
	UserData interface{} `json:"user-data,omitempty"`
}

type MMDSConfig

type MMDSConfig struct {
	Latest LatestConfig `json:"latest"`
}

type Metadata

type Metadata struct {
	InstanceID    string `json:"instance-id"`
	LocalHostname string `json:"local-hostname"`
}

type Nameservers

type Nameservers struct {
	Addresses []string `json:"addresses"`
}

type NetworkConfig

type NetworkConfig struct {
	Version   int                       `json:"version"`
	Renderer  string                    `json:"renderer,omitempty"`
	Ethernets map[string]EthernetConfig `json:"ethernets"`
}

type Options

type Options struct {
	OS                    string
	ImageDir              string
	FirecrackerBinaryPath string

	NumInstances int // 8
	// Number of vCPUs (either 1 or an even number)
	// Required: true
	// Maximum: 32
	// Minimum: 1
	VcpuCount int64
	// Memory size of VM
	// Required: true
	MemSizeMib int64

	GitHubToken string

	NatsURL      string
	NatsUsername string
	NatsPassword string
}

func NewOptions

func NewOptions() *Options

func (*Options) AddFlags

func (opts *Options) AddFlags(fs *pflag.FlagSet)

func (*Options) InitrdPath

func (opts *Options) InitrdPath() string

func (*Options) KernelImagePath

func (opts *Options) KernelImagePath() string

type Route

type Route struct {
	To  string `json:"to"`
	Via string `json:"via"`
}

type User

type User struct {
	Name              string   `json:"name"`
	PlainTextPasswd   string   `json:"plain_text_passwd,omitempty"`
	Gecos             string   `json:"gecos,omitempty"`
	Shell             string   `json:"shell,omitempty"`
	Groups            string   `json:"groups,omitempty"`
	Sudo              string   `json:"sudo,omitempty"`
	SSHAuthorizedKeys []string `json:"ssh_authorized_keys,omitempty"`
}

type UserData

type UserData struct {
	Users   []User   `json:"users"`
	Bootcmd []string `json:"bootcmd"`
}

Jump to

Keyboard shortcuts

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