models

package
v0.0.0-...-25f07f8 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCNINetworkName                   = "fcnet"
	DefaultCNIInterfaceName                 = "veth0"
	DefaultCNISubnet                        = "192.168.127.0/24"
	DefaultInternalNodeHost                 = "192.168.127.1"
	DefaultInternalNodePort                 = 9222
	DefaultNodeMemSizeMib                   = 256
	DefaultNodeVcpuCount                    = 1
	DefaultOtelExporterUrl                  = "127.0.0.1:14532"
	DefaultAgentHandshakeTimeoutMillisecond = 5000
)

Variables

View Source
var (
	// docker/OCI needs to be explicitly enabled in node configuration
	DefaultWorkloadTypes = []string{"elf", "v8", "wasm"}

	DefaultBinPath = append([]string{"/usr/local/bin"}, filepath.SplitList(os.Getenv("PATH"))...)

	// check the default cni bin path first, otherwise look in the rest of the PATH
	DefaultCNIBinPath = append([]string{"/opt/cni/bin"}, filepath.SplitList(os.Getenv("PATH"))...)
)

Functions

func GenerateConnectionFromOpts

func GenerateConnectionFromOpts(opts *Options, logger *slog.Logger) (*nats.Conn, error)

Types

type CNIDefinition

type CNIDefinition struct {
	BinPath       []string `json:"bin_path"`
	InterfaceName *string  `json:"interface_name"`
	NetworkName   *string  `json:"network_name"`
	Subnet        *string  `json:"subnet"`
}

Defines a reference to the CNI network name, which is defined and configured in a {network}.conflist file, as per CNI convention

type DevRunOptions

type DevRunOptions struct {
	Filename string
	// Stop a workload with the same name on a target
	AutoStop bool
	// Max bytes override for when we create the NEXCLIFILES bucket
	DevBucketMaxBytes uint
}

type HostServicesConfig

type HostServicesConfig struct {
	NatsUrl      string                   `json:"nats_url"`
	NatsUserJwt  string                   `json:"nats_user_jwt"`
	NatsUserSeed string                   `json:"nats_user_seed"`
	Services     map[string]ServiceConfig `json:"services"`
}

type Limiters

type Limiters struct {
	Bandwidth  *TokenBucket `json:"bandwidth,omitempty"`
	Operations *TokenBucket `json:"iops,omitempty"`
}

A set of rate limiters. These fields are identical to those in firecracker rate limiter configuration

type MachineTemplate

type MachineTemplate struct {
	VcpuCount  *int `json:"vcpu_count"`
	MemSizeMib *int `json:"memsize_mib"`
}

Defines the CPU and memory usage of a machine to be configured when it is added to the pool

type NodeConfiguration

type NodeConfiguration struct {
	AgentHandshakeTimeoutMillisecond int                 `json:"agent_handshake_timeout_ms,omitempty"`
	BinPath                          []string            `json:"bin_path"`
	CNI                              CNIDefinition       `json:"cni"`
	DefaultResourceDir               string              `json:"default_resource_dir"`
	ForceDepInstall                  bool                `json:"-"`
	InternalNodeHost                 *string             `json:"internal_node_host,omitempty"`
	InternalNodePort                 *int                `json:"internal_node_port"`
	KernelFilepath                   string              `json:"kernel_filepath"`
	MachinePoolSize                  int                 `json:"machine_pool_size"`
	MachineTemplate                  MachineTemplate     `json:"machine_template"`
	NoSandbox                        bool                `json:"no_sandbox,omitempty"`
	OtlpExporterUrl                  string              `json:"otlp_exporter_url,omitempty"`
	OtelMetrics                      bool                `json:"otel_metrics"`
	OtelMetricsPort                  int                 `json:"otel_metrics_port"`
	OtelMetricsExporter              string              `json:"otel_metrics_exporter"`
	OtelTraces                       bool                `json:"otel_traces"`
	OtelTracesExporter               string              `json:"otel_traces_exporter"`
	PreserveNetwork                  bool                `json:"preserve_network,omitempty"`
	RateLimiters                     *Limiters           `json:"rate_limiters,omitempty"`
	RootFsFilepath                   string              `json:"rootfs_filepath"`
	Tags                             map[string]string   `json:"tags,omitempty"`
	ValidIssuers                     []string            `json:"valid_issuers,omitempty"`
	WorkloadTypes                    []string            `json:"workload_types,omitempty"`
	HostServicesConfiguration        *HostServicesConfig `json:"host_services,omitempty"`

	// Public NATS server options; when non-nil, a public "userland" NATS server is started during node init
	PublicNATSServer *server.Options `json:"public_nats_server,omitempty"`

	Errors []error `json:"errors,omitempty"`
}

Node configuration is used to configure the node process as well as the virtual machines it produces

func DefaultNodeConfiguration

func DefaultNodeConfiguration() NodeConfiguration

func (*NodeConfiguration) Validate

func (c *NodeConfiguration) Validate() bool

type NodeOptions

type NodeOptions struct {
	ConfigFilepath  string `json:"-"`
	ForceDepInstall bool   `json:"-"`

	OtelMetrics         bool   `json:"-"`
	OtelMetricsPort     int    `json:"-"`
	OtelMetricsExporter string `json:"-"`
	OtelTraces          bool   `json:"-"`
	OtelTracesExporter  string `json:"-"`

	PreflightInit string `json:"-"`

	Errors []error `json:"errors,omitempty"`
}

Node configuration is used to configure the node process as well as the virtual machines it produces

func (*NodeOptions) Validate

func (c *NodeOptions) Validate() bool

type Options

type Options struct {
	Servers string
	// Creds is nats credentials to authenticate with
	Creds string
	// TlsCert is the TLS Public Certificate
	TlsCert string
	// TlsKey is the TLS Private Key
	TlsKey string
	// TlsCA is the certificate authority to verify the connection with
	TlsCA string
	// Timeout is how long to wait for operations
	Timeout time.Duration
	// ConnectionName is the name to use for the underlying NATS connection
	ConnectionName string
	// Username is the username or token to connect with
	Username string
	// Password is the password to connect with
	Password string
	// Nkey is the file holding a nkey to connect with
	Nkey string
	// Trace enables verbose debug logging
	Trace bool
	// SocksProxy is a SOCKS5 proxy to use for NATS connections
	SocksProxy string
	// TlsFirst configures theTLSHandshakeFirst behavior in nats.go
	TlsFirst bool
	// Namespace for scoping workload requests
	Namespace string
	// Type of logger
	Logger []string
	// LogLevel is the log level to use
	LogLevel string
	// LogJSON enables JSON logging
	LogTimeFormat string
	// Timeformat for logs.  Must satisfy time.Time format criteria
	LogsColorized bool
	// Outputs logs with color
	LogJSON bool
	// Name or path to a configuration context
	ConfigurationContext string
}

Options configure the CLI

type RootfsOptions

type RootfsOptions struct {
	OutName         string
	BaseImage       string
	BuildScriptPath string
	AgentBinaryPath string
	RootFSSize      int
}

type RunOptions

type RunOptions struct {
	Argv              string
	TargetNode        string
	WorkloadUrl       *url.URL
	Name              string
	WorkloadType      string
	Description       string
	PublisherXkeyFile string
	ClaimsIssuerFile  string
	Env               map[string]string
	Essential         bool
	DevMode           bool
	TriggerSubjects   []string
}

type ServiceConfig

type ServiceConfig struct {
	Enabled       bool            `json:"enabled"`
	Configuration json.RawMessage `json:"config"`
}

type StopOptions

type StopOptions struct {
	TargetNode       string
	WorkloadName     string
	WorkloadId       string
	ClaimsIssuerFile string
}

type TokenBucket

type TokenBucket struct {
	// The initial size of a token bucket.
	// Minimum: 0
	OneTimeBurst *int64 `json:"one_time_burst,omitempty"`

	// The amount of milliseconds it takes for the bucket to refill.
	// Required: true
	// Minimum: 0
	RefillTime *int64 `json:"refill_time"`

	// The total number of tokens this bucket can hold.
	// Required: true
	// Minimum: 0
	Size *int64 `json:"size"`
}

type UiOptions

type UiOptions struct {
	Port int
}

type WatchOptions

type WatchOptions struct {
	NodeId       string
	WorkloadId   string
	WorkloadName string
	LogLevel     string
}

Jump to

Keyboard shortcuts

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