firecracker

package
v0.8.7-93-g7c390a88 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

View Source
const (
	FirecrackerBin         = "firecracker"
	DefaultClientTimout    = time.Second * 5
	FirecrackerMemoryScale = 1024 * 1024
)

Variables

This section is empty.

Functions

func NewMachineV1alpha1Service

func NewMachineV1alpha1Service(ctx context.Context, opts ...any) (machinev1alpha1.MachineService, error)

NewMachineV1alpha1Service implements mdriver.NewDriverConstructor

Types

type ExecConfig

type ExecConfig struct {
	// Path to unix domain socket used by the API.
	// [default: "/run/firecracker.socket"]
	ApiSock string `flag:"--api-sock"`

	// Whether or not to load boot timer device for logging elapsed time since
	// InstanceStart command.
	BootTimer bool `flag:"--boot-timer"`

	// Path to a file that contains the microVM configuration in JSON format.
	ConfigFile string `flag:"--config-file"`

	// Print the data format version of the provided snapshot state file.
	DescribeSnapshot string `flag:"--describe-snapshot"`

	// Http API request payload max size, in bytes.
	// [default: "51200"]
	HttpApiMaxPayloadSize string `flag:"--http-api-max-payload-size"`

	// MicroVM unique identifier.
	// [default: "anonymous-instance"]
	Id string `flag:"--id"`

	// Set the logger level.
	// [default: "Warning"]
	Level string `flag:"--level"`

	// Path to a fifo or a file used for configuring the logger on startup.
	LogPath string `flag:"--log-path"`

	// Path to a file that contains metadata in JSON format to add to the mmds.
	Metadata string `flag:"--metadata"`

	// Mmds data store limit, in bytes.
	MmdsSizeLimit uint64 `flag:"--mmds-size-limit"`

	// Optional parameter which allows starting and using a microVM without an
	// active API socket.
	NoApi bool `flag:"--no-api"`

	// Optional parameter which allows starting and using a microVM without
	// seccomp filtering.  Not recommended.
	NoSeccomp bool `flag:"--no-seccomp"`

	// Parent process CPU time (wall clock, microseconds).
	// This parameter is optional.
	ParentCpuTimeUs uint64 `flag:"--parent-cpu-time-us"`

	// Optional parameter which allows specifying the path to a custom seccomp
	// filter.  For advanced users.
	SeccompFilter string `flag:"--seccomp-filter"`

	// Whether or not to output the level in the logs.
	ShowLevel bool `flag:"--show-level"`

	// Whether or not to include the file path and line number of the log's
	// origin.
	ShowLogOrigin bool `flag:"--show-log-origin"`
}

ExecConfig represents the command-line arguments for the Firecracker binary.

type FirecrackerConfig

type FirecrackerConfig struct {
	SocketPath string `json:"socketPath,omitempty"`
	BootArgs   string `json:"bootArgs,omitempty"`
	LogPath    string `json:"logPath,omitempty"`

	// TODO(craciunouc): This is a temporary solution until we have proper
	// un/marshalling of the resources (and all structures).
	Memory string `json:"memory,omitempty"`
}

FirecrackerConfig is a subset of the Firecracker's Go SDK structure of the same format. We use this subset because these are the only attribute necessary and additionally, gob cannot register some of the embedded types.

type MachineServiceV1alpha1Option

type MachineServiceV1alpha1Option func(*machineV1alpha1Service) error

MachineServiceV1alpha1Option represents an option-method handler for the machinev1alpha1 service.

func WithDebug

func WithDebug(debug bool) MachineServiceV1alpha1Option

WithDebug enables firecracker's internal debugging.

func WithTimeout

func WithTimeout(timeout time.Duration) MachineServiceV1alpha1Option

WithTimeout sets the time out when communicating with the firecracker socket API.

Jump to

Keyboard shortcuts

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