configs

package
v0.0.0-...-5b8b77a Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ChrootBaseMaxLength = 31

ChrootBaseMaxLength is the maximum length of the chroot base setting.

This limitation is dictated but the Kernel socket path maxmimum length set to 107 characters + zero terminator.

The constant jailer path suffix used by firebuild is 76 characters:

- constant /firecracker-v0.22.4-x86_64/ (automatically generated by the jailer) - VMM ID is always 20 characters long - constant /root/run/firecracker.socket assumed by the jailer

Example: /firecracker-v0.22.4-x86_64/sifuqm4rq2runxparjcx/root/run/firecracker.socket.

Using more than 31 characters for the --chroot-base value, regardless if in the profile setting or using the command --chroot-base flag, will lead to a very obscure error.

View Source
const DefaultVethIfaceName = "veth0"

DefaultVethIfaceName is the default veth interface name.

Variables

This section is empty.

Functions

func DefaultFirectackerStrategy

func DefaultFirectackerStrategy(machineConfig *MachineConfig) arbitrary.PlacingStrategy

DefaultFirectackerStrategy returns an instance of the default Firecracker Jailer strategy for a given machine config.

Types

type BaseOSCommandConfig

type BaseOSCommandConfig struct {
	Dockerfile string
	FSSizeMBs  int
	Tag        string
	// contains filtered or unexported fields
}

BaseOSCommandConfig is the baseos command configuration.

func NewBaseOSCommandConfig

func NewBaseOSCommandConfig() *BaseOSCommandConfig

NewBaseOSCommandConfig returns new command configuration.

func (*BaseOSCommandConfig) FlagSet

func (c *BaseOSCommandConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

type CNIConfig

type CNIConfig struct {
	BinDir   string `json:"BinDir" mapstructure:"BinDir"`
	ConfDir  string `json:"ConfDir" mapstructure:"ConfDir"`
	CacheDir string `json:"CacheDir" mapstructure:"CacheDir"`
	// contains filtered or unexported fields
}

CNIConfig provides CNI configuration options.

func NewCNIConfig

func NewCNIConfig() *CNIConfig

NewCNIConfig returns a new instance of the configuration.

func (*CNIConfig) FlagSet

func (c *CNIConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

type FcConfigProvider

type FcConfigProvider interface {
	ToSDKConfig() firecracker.Config
	WithHandlersAdapter(firecracker.HandlersAdapter) FcConfigProvider
	WithVethIfaceName(string) FcConfigProvider
}

FcConfigProvider is a Firecracker SDK configuration builder provider.

func NewFcConfigProvider

func NewFcConfigProvider(jailingFcConfig *JailingFirecrackerConfig, machineConfig *MachineConfig) FcConfigProvider

NewFcConfigProvider creates a new builder provider.

type InspectCommandConfig

type InspectCommandConfig struct {
	ValidatingConfig

	VMMID string
	// contains filtered or unexported fields
}

InspectCommandConfig is the inspect command configuration.

func NewInspectCommandConfig

func NewInspectCommandConfig() *InspectCommandConfig

NewInspectCommandConfig returns new command configuration.

func (*InspectCommandConfig) FlagSet

func (c *InspectCommandConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*InspectCommandConfig) Validate

func (c *InspectCommandConfig) Validate() error

Validate validates the correctness of the configuration.

type JailingFirecrackerConfig

type JailingFirecrackerConfig struct {
	sync.Mutex

	ProfileInheriting `json:"-"`
	ValidatingConfig  `json:"-"`

	BinaryFirecracker string `json:"BinaryFirecracker" mapstructure:"BinaryFirecracker"`
	BinaryJailer      string `json:"BinaryJailer" mapstructure:"BinaryJailer"`
	ChrootBase        string `json:"ChrootBase" mapstructure:"ChrootBase"`

	JailerGID      int `json:"JailerGid" mapstructure:"JailerGid"`
	JailerNumeNode int `json:"JailerNumaNode" mapstructure:"JailerNumaNode"`
	JailerUID      int `json:"JailerUid" mapstructure:"JailerUid"`

	NetNS string `json:"NetNS" mapstructure:"NetNS"`
	// contains filtered or unexported fields
}

JailingFirecrackerConfig represents Jailerspecific configuration options.

func NewJailingFirecrackerConfig

func NewJailingFirecrackerConfig() *JailingFirecrackerConfig

NewJailingFirecrackerConfig returns a new instance of the configuration.

func (*JailingFirecrackerConfig) FlagSet

func (c *JailingFirecrackerConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*JailingFirecrackerConfig) JailerChrootDirectory

func (c *JailingFirecrackerConfig) JailerChrootDirectory() string

JailerChrootDirectory returns a full path to the jailer configuration directory. This method will return empty string until the flag set returned by FlagSet() is parsed.

func (*JailingFirecrackerConfig) UpdateFromProfile

func (c *JailingFirecrackerConfig) UpdateFromProfile(input *profileModel.Profile) error

UpdateFromProfile updates the configuration from a profile.

func (*JailingFirecrackerConfig) VMMID

func (c *JailingFirecrackerConfig) VMMID() string

VMMID returns a configuration instance unique VMM ID.

func (*JailingFirecrackerConfig) Validate

func (c *JailingFirecrackerConfig) Validate() error

Validate validates the correctness of the configuration.

func (*JailingFirecrackerConfig) WithVMMID

WithVMMID allows overriding the VMM ID.

type KillCommandConfig

type KillCommandConfig struct {
	ValidatingConfig

	ShutdownTimeout time.Duration
	VMMID           string
	// contains filtered or unexported fields
}

KillCommandConfig is the kill command configuration.

func NewKillCommandConfig

func NewKillCommandConfig() *KillCommandConfig

NewKillCommandConfig returns new command configuration.

func (*KillCommandConfig) FlagSet

func (c *KillCommandConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*KillCommandConfig) Validate

func (c *KillCommandConfig) Validate() error

Validate validates the correctness of the configuration.

type LogConfig

type LogConfig struct {
	LogLevel      string
	LogColor      bool
	LogForceColor bool
	LogAsJSON     bool
	// contains filtered or unexported fields
}

LogConfig represents logging configuration.

func NewLogginConfig

func NewLogginConfig() *LogConfig

NewLogginConfig returns a new logging configuration.

func (*LogConfig) FlagSet

func (c *LogConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*LogConfig) NewLogger

func (c *LogConfig) NewLogger(name string) hclog.Logger

NewLogger returns a new configured logger.

type MachineConfig

type MachineConfig struct {
	ValidatingConfig `json:"-"`

	CNINetworkName    string `json:"CniNetworkName" mapstructure:"CniNetworkName"`
	CPU               int64  `json:"CPU" mapstructure:"CPU"`
	CPUTemplate       string `json:"CPUTemplate" mapstructure:"CPUTemplate"`
	HTEnabled         bool   `json:"HTEnabled" mapstructure:"HTEnabled"`
	IPAddress         string `json:"IPAddress" mapstructure:"IPAddress"`
	KernelArgs        string `json:"KernelArgs" mapstructure:"KernelArgs"`
	Mem               int64  `json:"Mem" mapstructure:"Mem"`
	NoMMDS            bool   `json:"NoMMDS" mapstructure:"NoMMDS"` // TODO: remove
	RootDrivePartUUID string `json:"RootDrivePartuuid" mapstructure:"RootDrivePartuuid"`
	SSHUser           string `json:"SSHUser" mapstructure:"SSHUser"`
	VMLinuxID         string `json:"VMLinux" mapstructure:"VMLinux"`

	LogFcHTTPCalls                 bool `json:"LogFirecrackerHTTPCalls" mapstructure:"LogFirecrackerHTTPCalls"`
	ShutdownGracefulTimeoutSeconds int  `json:"ShutdownGracefulTimeoutSeconds" mapstructure:"ShutdownGracefulTimeoutSeconds"`
	// contains filtered or unexported fields
}

MachineConfig provides machine configuration options.

func NewMachineConfig

func NewMachineConfig() *MachineConfig

NewMachineConfig returns a new instance of the configuration.

func (*MachineConfig) Daemonize

func (c *MachineConfig) Daemonize() bool

Daemonize returns the configured daemonize setting.

func (*MachineConfig) FlagSet

func (c *MachineConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*MachineConfig) KernelOverride

func (c *MachineConfig) KernelOverride() string

KernelOverride returns the configured kernel setting.

func (*MachineConfig) RootfsOverride

func (c *MachineConfig) RootfsOverride() string

RootfsOverride returns the configured rootfs setting.

func (*MachineConfig) Validate

func (c *MachineConfig) Validate() error

Validate validates the correctness of the configuration.

func (*MachineConfig) WithDaemonize

func (c *MachineConfig) WithDaemonize(input bool) *MachineConfig

WithDaemonize sets the daemonize setting.

func (*MachineConfig) WithKernelOverride

func (c *MachineConfig) WithKernelOverride(input string) *MachineConfig

WithKernelOverride sets the ketting setting.

func (*MachineConfig) WithRootfsOverride

func (c *MachineConfig) WithRootfsOverride(input string) *MachineConfig

WithRootfsOverride sets the rootfs setting.

type ProfileCommandConfig

type ProfileCommandConfig struct {
	ValidatingConfig `json:"-"`

	Profile        string
	ProfileConfDir string
	// contains filtered or unexported fields
}

ProfileCommandConfig provides the command profile selection configuration options.

func NewProfileCommandConfig

func NewProfileCommandConfig() *ProfileCommandConfig

NewProfileCommandConfig returns an initialized configuration instance.

func (*ProfileCommandConfig) FlagSet

func (c *ProfileCommandConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*ProfileCommandConfig) Validate

func (c *ProfileCommandConfig) Validate() error

Validate validates the correctness of the configuration.

type ProfileCreateConfig

type ProfileCreateConfig struct {
	ValidatingConfig `json:"-"`
	profilesModel.Profile

	Overwrite bool `json:"-"`
	// contains filtered or unexported fields
}

ProfileCreateConfig represents the profile create command configuration.

func NewProfileCreateConfig

func NewProfileCreateConfig() *ProfileCreateConfig

NewProfileCreateConfig returns an initialized configuration instance.

func (*ProfileCreateConfig) FlagSet

func (c *ProfileCreateConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*ProfileCreateConfig) Validate

func (c *ProfileCreateConfig) Validate() error

Validate validates the correctness of the configuration.

type ProfileInheriting

type ProfileInheriting interface {
	UpdateFromProfile(*profileModel.Profile) error
}

ProfileInheriting is a config which can take a profile configuration and amend its state from the profile provided settings.

type RootfsCommandConfig

type RootfsCommandConfig struct {
	BootstrapCertsKeySize                int
	BootstrapCertsValidity               time.Duration
	BootstrapInitialCommunicationTimeout time.Duration
	BootstrapServerBindInterface         string

	// Dockerfile build:
	BuildArgs       map[string]string
	Dockerfile      string
	DockerfileStage string

	// Docker image build:
	DockerImage     string
	DockerImageBase string

	// Shared settings:
	PostBuildCommands []string
	PreBuildCommands  []string
	Tag               string
	// contains filtered or unexported fields
}

RootfsCommandConfig is the rootfs command configuration.

func NewRootfsCommandConfig

func NewRootfsCommandConfig() *RootfsCommandConfig

NewRootfsCommandConfig returns new command configuration.

func (*RootfsCommandConfig) FlagSet

func (c *RootfsCommandConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*RootfsCommandConfig) Validate

func (c *RootfsCommandConfig) Validate() error

Validate validates the correctness of the configuration.

type RunCacheConfig

type RunCacheConfig struct {
	ProfileInheriting
	ValidatingConfig

	RunCache string
	// contains filtered or unexported fields
}

RunCacheConfig contains the run cache settings.

func NewRunCacheConfig

func NewRunCacheConfig() *RunCacheConfig

NewRunCacheConfig returns new run cahce command configuration.

func (*RunCacheConfig) FlagSet

func (c *RunCacheConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*RunCacheConfig) LocationBuilds

func (c *RunCacheConfig) LocationBuilds() string

LocationBuilds returns a full path to the builds run cache.

func (*RunCacheConfig) LocationRuns

func (c *RunCacheConfig) LocationRuns() string

LocationRuns returns a full path to the runs run cache.

func (*RunCacheConfig) UpdateFromProfile

func (c *RunCacheConfig) UpdateFromProfile(input *profileModel.Profile) error

UpdateFromProfile updates the configuration from a profile.

func (*RunCacheConfig) Validate

func (c *RunCacheConfig) Validate() error

Validate validates the correctness of the configuration.

type RunCommandConfig

type RunCommandConfig struct {
	ValidatingConfig

	Daemonize     bool
	EnvFiles      []string
	EnvVars       map[string]string
	From          string
	IdentityFiles []string
	Hostname      string
	Name          string
	Ports         []string
	// contains filtered or unexported fields
}

RunCommandConfig is the run command configuration.

func NewRunCommandConfig

func NewRunCommandConfig() *RunCommandConfig

NewRunCommandConfig returns new command configuration.

func (*RunCommandConfig) CaptureCmd

func (c *RunCommandConfig) CaptureCmd(inputargs []string)

CaptureCmd retrieves the command override from arguments.

func (*RunCommandConfig) CapturedCmd

func (c *RunCommandConfig) CapturedCmd() []string

CapturedCmd retrieves the captured command override.

func (*RunCommandConfig) FlagSet

func (c *RunCommandConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*RunCommandConfig) MergedEnvironment

func (c *RunCommandConfig) MergedEnvironment() (map[string]string, error)

MergedEnvironment returns merged envirionment declared by the configuration. The order of merging:

  • parse each env file in order provided
  • apply all individual --env values

Duplicated values are always overriden.

func (*RunCommandConfig) PublicKeys

func (c *RunCommandConfig) PublicKeys() ([]ssh.PublicKey, error)

PublicKeys returns an array of ssh.PublicKey obtainer from identity files.

func (*RunCommandConfig) Validate

func (c *RunCommandConfig) Validate() error

Validate validates the correctness of the configuration.

type TracingConfig

type TracingConfig struct {
	ProfileInheriting `json:"-"`

	ApplicationName string
	Enable          bool
	HostPort        string
	LogEnable       bool
	// contains filtered or unexported fields
}

TracingConfig is the tracing configuration.

func NewTracingConfig

func NewTracingConfig(appName string) *TracingConfig

NewTracingConfig returns a new instance of the configuration.

func (*TracingConfig) FlagSet

func (c *TracingConfig) FlagSet() *pflag.FlagSet

FlagSet returns an instance of the flag set for the configuration.

func (*TracingConfig) UpdateFromProfile

func (c *TracingConfig) UpdateFromProfile(input *profileModel.Profile) error

UpdateFromProfile updates the configuration from a profile.

type ValidatingConfig

type ValidatingConfig interface {
	Validate() error
}

ValidatingConfig is a config which can be validated.

Jump to

Keyboard shortcuts

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