sandbox

package
v0.0.0-...-8fe0098 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuildIDName  = "build_id"
	RootfsName   = "rootfs.ext4"
	SnapfileName = "snapfile"
	MemfileName  = "memfile"

	BuildDirName        = "builds"
	EnvInstancesDirName = "env-instances"
)
View Source
const (

	// This is the maximum number of IP addresses that can be allocated.
	IPSlotsSize = octetSize * octetSize

	HostSnapshotMask = 32
	VMask            = 30
	TapMask          = 30
)

We are using a more debuggable IP address allocation for now that only covers 255 addresses.

Variables

This section is empty.

Functions

func MockInstance

func MockInstance(envID, instanceID string, dns *dns.DNS, keepAlive time.Duration)

func Must

func Must[T any](obj T, err error) T

Types

type IPSlot

type IPSlot struct {
	ConsulToken string

	KVKey   string
	SlotIdx int
}

func NewSlot

func NewSlot(ctx context.Context, tracer trace.Tracer, consulClient *consul.Client) (*IPSlot, error)

func (*IPSlot) CreateNetwork

func (ips *IPSlot) CreateNetwork(
	ctx context.Context,
	tracer trace.Tracer,
) error

func (*IPSlot) HostIP

func (ips *IPSlot) HostIP() string

func (*IPSlot) HostSnapshotCIDR

func (ips *IPSlot) HostSnapshotCIDR() string

func (*IPSlot) HostSnapshotIP

func (ips *IPSlot) HostSnapshotIP() string

func (*IPSlot) HostSnapshotMask

func (ips *IPSlot) HostSnapshotMask() int

func (*IPSlot) NamespaceID

func (ips *IPSlot) NamespaceID() string

func (*IPSlot) NamespaceSnapshotIP

func (ips *IPSlot) NamespaceSnapshotIP() string

func (*IPSlot) Release

func (ips *IPSlot) Release(ctx context.Context, tracer trace.Tracer, consulClient *consul.Client) error

func (*IPSlot) RemoveNetwork

func (ipSlot *IPSlot) RemoveNetwork(ctx context.Context, tracer trace.Tracer) error

func (*IPSlot) TapCIDR

func (ips *IPSlot) TapCIDR() string

func (*IPSlot) TapIP

func (ips *IPSlot) TapIP() string

func (*IPSlot) TapMask

func (ips *IPSlot) TapMask() int

func (*IPSlot) TapName

func (ips *IPSlot) TapName() string

func (*IPSlot) VMask

func (ips *IPSlot) VMask() int

func (*IPSlot) VethCIDR

func (ips *IPSlot) VethCIDR() string

func (*IPSlot) VethIP

func (ips *IPSlot) VethIP() string

func (*IPSlot) VethName

func (ips *IPSlot) VethName() string

func (*IPSlot) VpeerCIDR

func (ips *IPSlot) VpeerCIDR() string

func (*IPSlot) VpeerIP

func (ips *IPSlot) VpeerIP() string

func (*IPSlot) VpeerName

func (ips *IPSlot) VpeerName() string

type MmdsMetadata

type MmdsMetadata struct {
	InstanceID string `json:"instanceID"`
	EnvID      string `json:"envID"`
	Address    string `json:"address"`
	TraceID    string `json:"traceID"`
	TeamID     string `json:"teamID"`
}

type PostInitJSONBody

type PostInitJSONBody struct {
	EnvVars *map[string]string `json:"envVars"`
}

type Sandbox

type Sandbox struct {
	Sandbox   *orchestrator.SandboxConfig
	StartedAt time.Time
	EndAt     time.Time
	TraceID   string
	// contains filtered or unexported fields
}

func NewSandbox

func NewSandbox(
	ctx context.Context,
	tracer trace.Tracer,
	consul *consul.Client,
	dns *dns.DNS,
	networkPool chan IPSlot,
	config *orchestrator.SandboxConfig,
	traceID string,
	startedAt time.Time,
	endAt time.Time,
) (*Sandbox, error)

func (*Sandbox) CleanupAfterFCStop

func (s *Sandbox) CleanupAfterFCStop(
	ctx context.Context,
	tracer trace.Tracer,
	consul *consul.Client,
	dns *dns.DNS,
	sandboxID string,
)

func (*Sandbox) EnsureClockSync

func (s *Sandbox) EnsureClockSync(ctx context.Context, port int64) error

func (*Sandbox) FcPid

func (s *Sandbox) FcPid() int

func (*Sandbox) SlotIdx

func (s *Sandbox) SlotIdx() int

func (*Sandbox) Stop

func (s *Sandbox) Stop(ctx context.Context, tracer trace.Tracer) error

func (*Sandbox) Wait

func (s *Sandbox) Wait(ctx context.Context, tracer trace.Tracer) error

type SandboxFiles

type SandboxFiles struct {
	UFFDSocketPath *string

	EnvPath      string
	BuildDirPath string

	EnvInstancePath string
	SocketPath      string

	KernelDirPath      string
	KernelMountDirPath string

	FirecrackerBinaryPath string
}

func (*SandboxFiles) Cleanup

func (f *SandboxFiles) Cleanup(
	ctx context.Context,
	tracer trace.Tracer,
) error

func (*SandboxFiles) Ensure

func (f *SandboxFiles) Ensure(ctx context.Context) error

func (*SandboxFiles) MemfilePath

func (f *SandboxFiles) MemfilePath() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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