Documentation
¶
Index ¶
- Constants
- Variables
- type Authentication
- func (auth Authentication) CACertPEM() []byte
- func (auth Authentication) ClientCertPEM() []byte
- func (auth Authentication) ClientPKPEM() []byte
- func (auth Authentication) ClientPrivKeyPKCS1() []byte
- func (auth Authentication) MarshalJSON() ([]byte, error)
- func (auth Authentication) ServerCertPEM() []byte
- func (auth Authentication) ServerPKPEM() []byte
- func (auth Authentication) ServerPrivKeyPKCS1() []byte
- func (auth *Authentication) UnmarshalJSON(data []byte) error
- func (auth Authentication) Validate() bool
- type Command
- type Container
- func (c Container) GetCPUSet() string
- func (c Container) GetCmd() strslice.StrSlice
- func (c Container) GetEntryPoint() strslice.StrSlice
- func (c Container) GetEnv() (envVars []string)
- func (c Container) GetMemory() (int64, error)
- func (c Container) GetMounts() []mount.Mount
- func (c Container) GetPortBindings() (nat.PortSet, nat.PortMap, error)
- type ContainerNetwork
- type Credentials
- type Duration
- type File
- type FileAndContainer
- type Instructions
- func (instruct Instructions) GetTimeRemaining() (time.Duration, error)
- func (instruct *Instructions) InsertHostInfo(domains, ips []string) error
- func (instruct *Instructions) MetaTo(out interface{}) error
- func (instruct Instructions) NeverTerminate() bool
- func (instruct *Instructions) Next() ([]Command, error)
- func (instruct *Instructions) PartialCompletion(failed []string) error
- func (instruct Instructions) Peek() ([]Command, error)
- func (instruct Instructions) Phase() (string, error)
- func (instruct *Instructions) PlaceInCredentials(log logrus.Ext1FieldLogger, auth Credentials)
- func (instruct *Instructions) PlaceInProperIDs(log logrus.Ext1FieldLogger, files []common.Metadata)
- func (instruct Instructions) Status() common.Status
- func (instruct *Instructions) UnmarshalJSON(data []byte) error
- type Mount
- type Netconf
- type Network
- type Order
- type OrderPayload
- type OrderType
- type PullImage
- type ResumeExecution
- type SetupSwarm
- type SimpleName
- type StartContainer
- type Target
- type Test
- type Time
- type Timeout
- type Volume
- type VolumeShare
Constants ¶
const ( // Createcontainer attempts to create a docker container Createcontainer = OrderType("createcontainer") // Startcontainer attempts to start an already created docker container Startcontainer = OrderType("startcontainer") // Removecontainer attempts to remove a container Removecontainer = OrderType("removecontainer") // Createnetwork attempts to create a network Createnetwork = OrderType("createnetwork") // Attachnetwork attempts to remove a network Attachnetwork = OrderType("attachnetwork") // Detachnetwork detaches network Detachnetwork = OrderType("detachnetwork") // Removenetwork removes network Removenetwork = OrderType("removenetwork") // Createvolume creates volume Createvolume = OrderType("createvolume") // Removevolume removes volume Removevolume = OrderType("removevolume") // Putfileincontainer puts file in container Putfileincontainer = OrderType("putfileincontainer") // Emulation emulates Emulation = OrderType("emulation") // SwarmInit sets up the docker swarm SwarmInit = OrderType("swarminit") // Pullimage pre-emptively pulls the given image Pullimage = OrderType("pullimage") Volumeshare = OrderType("volumeshare") // Pauseexecution means wait a certain amount of time before continuing Pauseexecution = OrderType("pauseexecution") //Payload will be Duration // Resumeexecution contains the instructions for preparing for the next phase Resumeexecution = OrderType("resumeexecution") )
const ( // PhaseKey is the meta key for the phase name PhaseKey = "phase" // OrgIDKey is the location of the org id in meta OrgIDKey = "org" // TestIDKey is the location of the test id in the meta TestIDKey = "testRun" // TestNameKey is the location of the test name in the meta TestNameKey = "test" // DefinitionIDKey is the location of the definition in the meta DefinitionIDKey = "definition" )
*
- Note: changing any of these constants is a breaking change, so use caution.
const ( // ServiceNumberSub is the magical value which gets replaced with the node number in pre-processing for inputs ServiceNumberSub = "$_n" // HostDomainSub is the magical value which gets replaced with the host's DNS for env vars HostDomainSub = "$_host" )
const ( InfiniteTimeTerm = "infinite" DefaultTimeout = 2 * time.Minute )
const KeySize = 4096
const OneYearDuration = time.Hour * 8760
const SerialRandSize = 8
Variables ¶
var ( // NoExpiration is the placeholder for the expiration to be ignored NoExpiration = time.Unix(0, 0) // NoTimeout indicates that there is no timeout duration provided NoTimeout time.Duration = -1 // NoDuration indicates that duration is not set NoDuration time.Duration = 0 // ErrNoCommands is when commands are needed but there are none ErrNoCommands = errors.New("there are no commands") // ErrNoPhase means that the commands meta doesn't include phase data ErrNoPhase = errors.New("phase not found") // ErrDone is given when isntructions is finished after this round ErrDone = errors.New("all done") // ErrTooManyFailed represents when given more failures than commands ErrTooManyFailed = errors.New("more commands failed than currently exist") // ErrNotAllFound is for when one or more commands where not matched up with the given ids ErrNotAllFound = errors.New("one or more commands where not matched up with the given ids") )
var (
InfiniteDuration = Duration{Time{/* contains filtered or unexported fields */}}
)
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
type Authentication struct { CAKey *rsa.PrivateKey ServerKey *rsa.PrivateKey ClientKey *rsa.PrivateKey CACert []byte ServerCert []byte ClientCert []byte }
func GenerateAuth ¶
func GenerateAuth() (out Authentication, err error)
func (Authentication) CACertPEM ¶
func (auth Authentication) CACertPEM() []byte
func (Authentication) ClientCertPEM ¶
func (auth Authentication) ClientCertPEM() []byte
func (Authentication) ClientPKPEM ¶
func (auth Authentication) ClientPKPEM() []byte
func (Authentication) ClientPrivKeyPKCS1 ¶
func (auth Authentication) ClientPrivKeyPKCS1() []byte
func (Authentication) MarshalJSON ¶
func (auth Authentication) MarshalJSON() ([]byte, error)
func (Authentication) ServerCertPEM ¶
func (auth Authentication) ServerCertPEM() []byte
func (Authentication) ServerPKPEM ¶
func (auth Authentication) ServerPKPEM() []byte
func (Authentication) ServerPrivKeyPKCS1 ¶
func (auth Authentication) ServerPrivKeyPKCS1() []byte
func (*Authentication) UnmarshalJSON ¶
func (auth *Authentication) UnmarshalJSON(data []byte) error
func (Authentication) Validate ¶
func (auth Authentication) Validate() bool
type Command ¶
type Command struct { // ID is the unique id of this command ID string `json:"id"` // Target represents the target of this command Target Target `json:"target"` // Order is the action of the command, it represents what needs to be done Order Order `json:"order"` // Meta is extra informative data to be passed with the command Meta map[string]string `json:"meta"` // contains filtered or unexported fields }
Command is the command sent to Definition.
func NewCommand ¶
NewCommand properly creates a new command
func (Command) Parent ¶
func (cmd Command) Parent() *Instructions
Parent function exists to prevent parent from showing up when a command is marshal with any marshaller
func (Command) ParseOrderPayloadInto ¶
ParseOrderPayloadInto attempts to Marshal the payload into the object pointed to by out
type Container ¶
type Container struct { // BoundCpus are the cpus which the container will be set with an affinity for. BoundCPUs []int `json:"boundCPUs,omitonempty"` // EntryPoint overrides the docker containers entrypoint if non-empty EntryPoint string `json:"entrypoint"` // Environment represents the environment kv which will be provided to the container Environment map[string]string `json:"environment"` // Labels are any identifier which are to be attached to the container Labels map[string]string `json:"labels"` // Name is the unique name of the docker container Name string `json:"name"` // Network is the primary network(s) for this container to be attached to Network string `json:"network"` // TCPPorts to be opened for each container, each port associated. TCPPorts map[int]int `json:"tcpPorts"` // UDPPorts to be opened for each container, each port associated. UDPPorts map[int]int `json:"udpPorts"` // Volumes are the docker volumes to be mounted on this container Volumes []Mount `json:"volumes"` // HostVolumes contains the host filesystem volumes. Mounts on /var/lib/docker/genesis/{key}/{container}:{value} HostVolumes map[string]string `json:"hostVolumes"` // Cpus should be a floating point value represented as a string, and // is equivalent to the percentage of a single cores time which can be used // by a node. Can be more than 1.0, meaning the node can use multiple cores at // a time. Cpus string `json:"cpus"` // Memory supports values up to Terrabytes (tb). If the unit is omitted, then it // is assumed to be bytes. This is not case sensitive. Memory string `json:"memory"` // Image is the docker image Image string `json:"image"` // Args are the arguments passed to the containers entrypoint Args []string `json:"args"` // IP is the IP address on the primary network IP string `json:"ip"` // AutoRemove flags a container to be automatically removed AutoRemove bool `json:"autoremove"` User string `json:"user"` Credentials }
Container represents a docker container, this is calculated from the payload of the Run command
func (Container) GetEntryPoint ¶
GetEntryPoint returns the properly formatted entrypoint if this container has one, otherwise returns nil
func (Container) GetEnv ¶
GetEnv gets the environment variables in the format which is expected by docker
type ContainerNetwork ¶
type ContainerNetwork struct { // Name of the container. Container string `json:"container"` // Name of the network. Network string `json:"network"` // IP is the IP address of the container in this network IP string `json:"ip,omitempty"` }
ContainerNetwork is a container and network order payload.
type Credentials ¶
type Credentials struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` RegistryToken string `json:"registrytoken,omitempty"` }
func (Credentials) Empty ¶
func (cred Credentials) Empty() bool
type Duration ¶
type Duration struct {
Time
}
func (*Duration) UnmarshalJSON ¶
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML converts from yaml into this object
type File ¶
type File struct { // Mode is permission and mode bits Mode int64 `json:"mode"` // Destination is the mount point of the file Destination string `json:"destination"` // ID is the UUID of the file ID string `json:"id"` // Meta data on the file Meta common.Metadata `json:"meta"` }
File represents a file which will be placed inside either a docker container or volume
type FileAndContainer ¶
type FileAndContainer struct { // Name of the container. ContainerName string `json:"container"` // Name of the file. File File `json:"file"` }
FileAndContainer is a file and container order payload.
type Instructions ¶
type Instructions struct { ID string `json:"id,omitempty"` OrgID string `json:"orgID,omitempty"` DefinitionID string `json:"definitionID,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` Commands [][]Command `json:"commands,omitempty"` Round int `json:"round,omitempty"` GlobalTimeout Timeout `json:"globalTimeout,omitempty"` GlobalExpiration time.Time `json:"globalExpiration,omitempty"` PhaseTimeouts map[string]Timeout `json:"phaseTimeouts,omitempty"` PhaseExpirations map[string]time.Time `json:"phaseExpirations,omitempty"` Meta map[string]interface{} `json:"meta,omitempty"` Auth Authentication `json:"auth"` TeardownCmd biome.DestroyBiome `json:"teardownCmd"` }
Instructions contains all of the execution based information, for use in anything that executes the Commands
func (Instructions) GetTimeRemaining ¶
func (instruct Instructions) GetTimeRemaining() (time.Duration, error)
func (*Instructions) InsertHostInfo ¶
func (instruct *Instructions) InsertHostInfo(domains, ips []string) error
func (*Instructions) MetaTo ¶
func (instruct *Instructions) MetaTo(out interface{}) error
MetaTo takes the given meta fields and puts them into the given struct ptr. Should be easier than having to do lots of type conversions directly on the meta. This uses json marshalling to accomplish it
func (Instructions) NeverTerminate ¶
func (instruct Instructions) NeverTerminate() bool
func (*Instructions) Next ¶
func (instruct *Instructions) Next() ([]Command, error)
Next pops the first element off of Commands. If this results in Commands being empty, it returns ErrDone.
func (*Instructions) PartialCompletion ¶
func (instruct *Instructions) PartialCompletion(failed []string) error
func (Instructions) Peek ¶
func (instruct Instructions) Peek() ([]Command, error)
Peek is like Next, but does not make any state changes
func (Instructions) Phase ¶
func (instruct Instructions) Phase() (string, error)
func (*Instructions) PlaceInCredentials ¶
func (instruct *Instructions) PlaceInCredentials(log logrus.Ext1FieldLogger, auth Credentials)
func (*Instructions) PlaceInProperIDs ¶
func (instruct *Instructions) PlaceInProperIDs(log logrus.Ext1FieldLogger, files []common.Metadata)
func (Instructions) Status ¶
func (instruct Instructions) Status() common.Status
func (*Instructions) UnmarshalJSON ¶
func (instruct *Instructions) UnmarshalJSON(data []byte) error
UnmarshalJSON creates Instructions from JSON, and also handles creating the links back this object
type Mount ¶
type Mount struct { Name string `json:"name"` Directory string `json:"directory"` ReadOnly bool `json:"readOnly"` }
Mount represents the information needed for the mounting of a volume
type Netconf ¶
type Netconf struct { // Container is the target container Container string `json:"container"` // Network is the target network Network string `json:"network"` // Limit is the max number of packets to hold the in queue Limit int `json:"limit"` // Loss represents packet loss % ie 100% = 100 Loss float64 `json:"loss"` // Delay represents the latency to be applied in microseconds Delay int `json:"delay"` // Rate represents the bandwidth constraint to be applied to the network Rate string `json:"rate"` // Duplication represents the percentage of packets to duplicate Duplication float64 `json:"duplicate"` // Corrupt represents the percentage of packets to corrupt Corrupt float64 `json:"corrupt"` // Reorder represents the percentage of packets that get reordered Reorder float64 `json:"reorder"` }
Netconf represents network impairments which are to be applied to a network
type Network ¶
type Network struct { //Name is the name of the network Name string `json:"name"` Subnet string `json:"subnet"` Gateway string `json:"gateway"` Global bool `json:"global"` Labels map[string]string `json:"labels"` }
Network represents a logic network on which containers exist
type Order ¶
type Order struct { // Type is the type of the order Type OrderType `json:"type"` // Payload is the payload object of the order Payload OrderPayload `json:"payload"` }
Order to be executed by Definition
type OrderPayload ¶
type OrderPayload interface { }
OrderPayload is a pointer interface for order payloads.
type PullImage ¶
type PullImage struct { Image string `json:"image"` Credentials }
PullImage contains the information necessary to pull a docker image from a registry
type ResumeExecution ¶
type ResumeExecution struct {
Tasks []string `json:"tasks,omitempty"`
}
ResumeExecution contains the tasks to kill before resuming execution if there are any
type SetupSwarm ¶
type SetupSwarm struct { //Hosts is an array of the hosts to be setup with docker swarm Hosts []string `json:"hosts"` }
SetupSwarm is the payload to setup a docker swarm
type SimpleName ¶
type SimpleName struct { // Name of the container. Name string `json:"name"` }
SimpleName is a simple order payload with just the container name
type StartContainer ¶
type StartContainer struct { Name string `json:"name"` IgnoreExitCode bool `json:"ignoreExitCode"` Attach bool `json:"attach"` // Timeout is the maximum amount of time to wait for the task before terminating it. // This is ignored if attach is false Timeout Timeout `json:"timeout"` }
StartContainer is the command for starting a container
type Target ¶
type Target struct {
IP string `json:"ip"`
}
Target sets the target of a command - which testnet, instance to hit
type Test ¶
type Test struct { Instructions ProvisionCommand biome.CreateBiome `json:"provisionCommand"` }
Test contains the instructions necessary for the execution of a single test
func (Test) GetDestroyCommand ¶
func (t Test) GetDestroyCommand() biome.DestroyBiome
func (Test) GuessSteps ¶
func (*Test) UnmarshalJSON ¶
UnmarshalJSON prevents Instructions from taking this over
type Time ¶
Time represents the frame of time which can be infinite
func (Time) IsInfinite ¶
func (Time) MarshalJSON ¶
func (Time) MarshalYAML ¶
type Timeout ¶
type Timeout struct {
Time
}
func (Timeout) SetInfinite ¶
func (*Timeout) UnmarshalJSON ¶
func (*Timeout) UnmarshalYAML ¶
UnmarshalYAML converts from yaml into this object
type Volume ¶
type Volume struct { // Name is the name of the docker volume Name string `json:"name"` // Labels to be attached to the volume Labels map[string]string `json:"labels"` Global bool `json:"global"` Hosts []string `json:"hosts,omitempty"` }
Volume represents a docker volume which may be shared among multiple containers
type VolumeShare ¶
type VolumeShare struct {
}VolumeShare prepares the environment for global volumes