Documentation ¶
Index ¶
- Constants
- Variables
- func BuildNetCfg(eth0Mac, eth1Mac, ip0, ip1 string) (string, error)
- func CreateTap(name, cidr string) error
- func CreateTap_(name, cidr string) (netlink.Link, error)
- func GetEgressInterface() (string, error)
- func MacAddr(b []byte) string
- func PrepareCloudInitUserData(ud UserData, script string) ([]byte, error)
- func SetupIPTables(iface, tapDev string) error
- func TapDelete(name string) error
- func TapDelete_(name string) error
- func TapExists(name string) bool
- func WorkflowRunRootFSPath(uid string) string
- type EthernetConfig
- type EthernetMatcher
- type Instance
- type Instances
- type LatestConfig
- type MMDSConfig
- type Metadata
- type Nameservers
- type NetworkConfig
- type Options
- type Route
- type User
- type UserData
Constants ¶
const ( MMDS_IP = "169.254.169.254" MMDS_SUBNET = 16 VMS_NETWORK_PREFIX = "172.26.0" VMS_NETWORK_SUBNET = 30 )
Variables ¶
var DefaultOptions = NewOptions()
Functions ¶
func BuildNetCfg ¶
func CreateTap ¶
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_ ¶
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 SetupIPTables ¶
Host iface bond0 detect using EGRESS_IFACE=`ip route get 8.8.8.8 |grep uid |sed 's/.* dev \([^ ]*\) .*/\1/'`
func TapDelete_ ¶
func WorkflowRunRootFSPath ¶
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 Instances ¶
type Instances struct {
// contains filtered or unexported fields
}
func NewInstances ¶
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"`
}
func BuildData ¶
func BuildData(ghToken string, instanceID int, ghUsernames ...string) (*MMDSConfig, error)
https://gist.github.com/tamalsaha/af2f99c80f84410253bd1e532bdfabc7
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) InitrdPath ¶
func (*Options) KernelImagePath ¶
func (*Options) RootFSPath ¶
script gist: https://gist.github.com/tamalsaha/af2f99c80f84410253bd1e532bdfabc7
curl -L https://gist.githubusercontent.com/tamalsaha/af2f99c80f84410253bd1e532bdfabc7/raw/c1b3647e43a28d17d24cbcb2db2063d61bebf455/build_rootfs.sh | bash -s -- bionic 20G
curl -L https://gist.githubusercontent.com/tamalsaha/af2f99c80f84410253bd1e532bdfabc7/raw/c1b3647e43a28d17d24cbcb2db2063d61bebf455/build_rootfs.sh | bash -s -- focal 20G
curl -L https://gist.githubusercontent.com/tamalsaha/af2f99c80f84410253bd1e532bdfabc7/raw/c1b3647e43a28d17d24cbcb2db2063d61bebf455/build_rootfs.sh | bash -s -- jammy 20G
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"` }