env

package
v0.0.0-...-dcd6d33 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIHost = "http://localhost:50001"
)
View Source
const (
	ToMBShift = 20
)

Variables

View Source
var EnvInstanceTemplate = template.Must(template.New("provisioning-script").Parse(provisionEnvScriptFile))

Functions

func MockBuild

func MockBuild(envID, buildID string)

Types

type BuildLogsWriter

type BuildLogsWriter struct {
	Done chan struct{}
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(envID string, buildID string, apiSecret string) BuildLogsWriter

func (BuildLogsWriter) Close

func (w BuildLogsWriter) Close() error

func (BuildLogsWriter) Write

func (w BuildLogsWriter) Write(p []byte) (n int, err error)

type Env

type Env struct {
	// Unique ID of the env.
	EnvID string
	// Unique ID of the build - this is used to distinguish builds of the same env that can start simultaneously.
	BuildID string

	// Command to run when building the env.
	StartCmd string

	// Path to the directory where all envs are stored.
	EnvsDiskPath string

	// Path to the directory where all docker contexts are stored. This directory is a FUSE mounted bucket where the contexts were uploaded.
	DockerContextsPath string

	// Docker registry where the docker images are uploaded for archivation/caching.
	DockerRegistry string

	// Path to the firecracker binary.
	FirecrackerBinaryPath string

	// Path to the envd.
	EnvdPath string

	ContextFileName string

	// The number of vCPUs to allocate to the VM.
	VCpuCount int64

	// The amount of RAM memory to allocate to the VM, in MiB.
	MemoryMB int64

	// The amount of free disk to allocate to the VM, in MiB.
	DiskSizeMB int64

	// Path to the directory where the temporary files for the build are stored.
	BuildLogsWriter io.Writer

	// Google service account JSON secret base64 encoded.
	GoogleServiceAccountBase64 string

	// Path to the directory where the dir with kernel is mounted.
	KernelMountDir string

	// Directory with the kernels.
	KernelsDir string

	// Name of the kernel file.
	KernelName string

	// Version of the kernel.
	KernelVersion string

	// Whether to use hugepages or not.
	HugePages bool
	// contains filtered or unexported fields
}

func (*Env) Build

func (e *Env) Build(ctx context.Context, tracer trace.Tracer, docker *client.Client, legacyDocker *docker.Client) error

func (*Env) Cleanup

func (e *Env) Cleanup(ctx context.Context, tracer trace.Tracer)

func (*Env) DockerContextPath

func (e *Env) DockerContextPath() string

Path to the docker context.

func (*Env) KernelDirPath

func (e *Env) KernelDirPath() string

Path to the directory where the kernel is stored.

func (*Env) KernelMountedPath

func (e *Env) KernelMountedPath() string

Path to the directory where the kernel can be accessed inside when the dirs are mounted.

func (*Env) MoveToEnvDir

func (e *Env) MoveToEnvDir(ctx context.Context, tracer trace.Tracer) error

func (*Env) RootfsSize

func (e *Env) RootfsSize() int64

Path to the directory where the kernel is stored.

type FCNetwork

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

func NewFCNetwork

func NewFCNetwork(ctx context.Context, tracer trace.Tracer, env *Env) (*FCNetwork, error)

func (*FCNetwork) Cleanup

func (n *FCNetwork) Cleanup(ctx context.Context, tracer trace.Tracer)

type LogsData

type LogsData struct {
	APISecret string   `json:"apiSecret"`
	Logs      []string `json:"logs"`
}

type MultiWriter

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

func (*MultiWriter) Write

func (mw *MultiWriter) Write(p []byte) (int, error)

type Rootfs

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

func NewRootfs

func NewRootfs(ctx context.Context, tracer trace.Tracer, env *Env, docker *client.Client, legacyDocker *docker.Client) (*Rootfs, error)

type Snapshot

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

func NewSnapshot

func NewSnapshot(ctx context.Context, tracer trace.Tracer, env *Env, network *FCNetwork, rootfs *Rootfs) (*Snapshot, error)

Jump to

Keyboard shortcuts

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