config

package
v0.0.0-...-ed1113b Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AllocRunnerTypeSim is the simulated alloc runner included within nodesim
	// under the package allocrunnersim.
	AllocRunnerTypeSim = "sim"

	// AllocRunnerTypeReal is the alloc runner which is set up from the Nomad
	// codebase directly. This implements the task runner and hooks for a real
	// client experience.
	AllocRunnerTypeReal = "real"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// WorkDir is the filesystem path that nodesim will use to write
	// application data. This path will also be passed to each simulated client
	// for their state and allocation directories.
	WorkDir string `hcl:"work_dir,optional"`

	// NodeNamePrefix is the prefix identifier that should be used when
	// generating the simulated client name and ID.
	NodeNamePrefix string `hcl:"node_name_prefix,optional"`

	// ServerAddr is a slice of server RPC addresses which will be used for the
	// clients initial registration.
	ServerAddr arrayFlagVar `hcl:"server_addr,optional"`

	// NodeNum is the number of Nomad clients/nodes that will be started within
	// this single nodesim process. Some basic testing indicates you will need
	// to allocate 0.8MHz of CPU and 0.7MiB of memory per client instance.
	NodeNum int `hcl:"node_num,optional"`

	// AllocRunnerType defines what alloc-runner nodesim will build. It
	// supports either the basic simulated runner included within this
	// application, or the "real" one pulled directly from Nomad.
	AllocRunnerType string `hcl:"alloc_runner_type,optional"`

	Log  *Log  `hcl:"log,block"`
	Node *Node `hcl:"node,block"`
}

Config is the top-level and main configuration object used for running the nodesim application. It contains all the information required to run both the application and all executed Nomad simulated nodes.

func Default

func Default() *Config

Default returns a default configuration object with all parameters set to their default values. This returned object can be used as the basis for merging user supplied data.

func ParseFile

func ParseFile(filePath string) (*Config, error)

func (*Config) Merge

func (c *Config) Merge(z *Config) *Config

type Log

type Log struct {

	// Level is the logger level that should be used. This can be any one of
	// "trace", "debug", "info", "warn", "error", and "off" and is
	// case-insensitive.
	Level string `hcl:"level,optional"`

	// JSON indicates whether the log lines should be formatted in JSON or not.
	JSON bool `hcl:"json,optional"`

	// IncludeLocation indicates whether to include file and line information
	// in each log line.
	IncludeLocation bool `hcl:"include_location,optional"`
}

Log details the log configuration parameters for the nodesim application. It does not control the log configuration of each simulated Nomad node.

type Node

type Node struct {
	Region     string `hcl:"region,optional"`
	Datacenter string `hcl:"datacenter,optional"`
	NodePool   string `hcl:"node_pool,optional"`
	NodeClass  string `hcl:"node_class,optional"`

	// Options is a list of Nomad client options mapping as described:
	// https://developer.hashicorp.com/nomad/docs/configuration/client#options
	//
	// In particular, this can be used to disable finger-printers which are not
	// required, or which have lengthy timeouts which can slow client startup
	// times.
	Options map[string]string `hcl:"options,optional"`
}

Node is the configuration object that is used to configure the Nomad clients that are instantiated by simnode. It contains a small subset of parameters which allow for useful configuration to account for environment specific details, are testing scenarios.

Jump to

Keyboard shortcuts

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