config

package
v0.0.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalFlags

type AdditionalFlags struct {
	//  List of additional flags for clients
	Clients []string `yaml:"clients"`
	//  List of additional flags for server
	Server []string `yaml:"server"`
}

AdditionalFlags additional flags structure for Server and Clients

type AnsibleGroups

type AnsibleGroups struct {
	// Server inventory server group name
	Server string `yaml:"server"`
	// Clients inventory clients group name
	Clients string `yaml:"clients"`
}

AnsibleGroups server and clients host group names in the used inventory file(s)

type AnsibleTimeouts

type AnsibleTimeouts struct {
	// Timeout duration for `ansible` and `ansible-inventory` calls (NOT task command timeouts)
	CommandTimeout time.Duration `yaml:"commandTimeout"`
	// Timeout duration for `ansible` Task command calls
	TaskCommandTimeout time.Duration `yaml:"taskCommandTimeout"`
}

AnsibleTimeouts timeouts for Ansible command runs

type CSV

type CSV struct {
	FilePath
}

CSV CSV Output config options

type Config

type Config struct {
	Version string  `yaml:"version"`
	Runner  Runner  `yaml:"runner"`
	Tests   []*Test `yaml:"tests"`
}

Config Config object for the config file

func Load

func Load(cfgFile string) (*Config, error)

Load load the given config file

func New

func New() *Config

New return a new Config object with the `Version` set by default

type Defaults

type Defaults interface {
	Defaults()
}

Defaults interface to implement for config parts which allow a "verification" / Setting Defaults

type Dump

type Dump struct {
	FilePath
}

Dump Dump Output config options

type Excelize

type Excelize struct {
	FilePath
	// After what amount of rows the Excel file should be saved
	SaveAfterRows int `yaml:"saveAfterRows"`
}

Excelize Excelize Output config options. TODO implement

type FilePath

type FilePath struct {
	// File base path for output
	FilePath string `yaml:"filePath" validate:"required,min=1"`
	// File name pattern templated from various availables during output generation
	NamePattern string `yaml:"namePattern" validate:"required,min=1"`
}

FilePath file path and name pattern for outputs file generation

type GoChart

type GoChart struct {
	FilePath
	// Types of charts to produce from the testers output data
	Types []string `yaml:"types" validate:"required,min=1"`
}

GoChart GoChart Output config options

type Hosts

type Hosts struct {
	// Name of this hosts selection.
	Name string `yaml:"name"`
	// If all hosts available should be used.
	All bool `yaml:"all"`
	// Select `Count` Random hosts from the available hosts list.
	Random bool `yaml:"random"`
	// Must be used with `Random`, will cause `Count` times Nodes to be randomly selected from all applicable hosts.
	Count int `yaml:"count"`
	// Static list of hosts (this list is not checked for accuracy)
	Hosts []string `yaml:"hosts"`
	// "Label" selector for the dynamically generated hosts list, e.g., Kubernetes label selector
	HostSelector map[string]string `yaml:"hostSelector"`
	// AntiAffinity not implemented yet
	AntiAffinity []string `yaml:"antiAffinity"`
}

Hosts options for hosts selection for a Test

type IPerf3

type IPerf3 struct {
	// Additional flags for client and server
	AdditionalFlags AdditionalFlags `yaml:"additionalFlags"`
	// If UDP should be used for the IPerf3 test
	UDP *bool `yaml:"udp"`
}

IPerf3 IPerf3 config structure for testers.Tester config

type KubernetesHosts

type KubernetesHosts struct {
	// If Nodes that are `SchedulingDisabled` should be ignored
	IgnoreSchedulingDisabled *bool `yaml:"ignoreSchedulingDisabled"`
	// List of Kubernetes corev1.Toleration to tolerate when selecting Nodes
	Tolerations []corev1.Toleration `yaml:"tolerations"`
}

KubernetesHosts hosts selection options for Kubernetes

func (*KubernetesHosts) SetDefaults

func (c *KubernetesHosts) SetDefaults()

SetDefaults set defaults on config part

type KubernetesServiceAccounts

type KubernetesServiceAccounts struct {
	// Server ServiceAccount name to use for server Pods
	Server string `yaml:"server,omitempty"`
	// Clients ServiceAccount name to use for client Pods
	Clients string `yaml:"clients,omitempty"`
}

KubernetesServiceAccounts server and client ServiceAccount name to use for the created Pods

type KubernetesTimeouts

type KubernetesTimeouts struct {
	// Timeout for object deletion
	DeleteTimeout int `yaml:"deleteTimeout"`
	// Timeout for "Pod running" check
	RunningTimeout int `yaml:"runningTimeout"`
	// Timeout for "Pod succeded" check (e.g., client Pod exits after Pod)
	SucceedTimeout int `yaml:"succeedTimeout"`
}

KubernetesTimeouts timeouts for operations with Kubernetess

func (*KubernetesTimeouts) SetDefaults

func (c *KubernetesTimeouts) SetDefaults()

SetDefaults set defaults on config part

type MySQL

type MySQL struct {
	// MySQL DSN, format `[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]`, for more information see https://github.com/go-sql-driver/mysql#dsn-data-source-name
	DSN string `yaml:"dsn"`
	// Pattern used for templating the name of the table used in the MySQL database, the tables are created automatically when MySQL.AutoCreateTables is set to `true`
	TableNamePattern string `yaml:"tableNamePattern"`
	// Automatically create tables in the MySQL database (default `true`)
	AutoCreateTables *bool `yaml:"autoCreateTables"`
}

MySQL MySQL Output config options

type Output

type Output struct {
	// Name of this output
	Name string `yaml:"name"`
	// CSV output options
	CSV *CSV `yaml:"csv"`
	// GoChart output options
	GoChart *GoChart `yaml:"goChart"`
	// Dump output options
	Dump *Dump `yaml:"dump"`
	// Excelize output options
	Excelize *Excelize `yaml:"excelize"`
	// SQLite output options
	SQLite *SQLite `yaml:"sqlite"`
	// MySQL output options
	MySQL *MySQL `yaml:"mysql"`
}

Output Output config structure pointing to the other config options for each output

type RunMode

type RunMode string

RunMode custom run mode const type for

const (
	// RunModeSequential run tasks in sequential / serial order
	RunModeSequential RunMode = "sequential"
	// RunModeParallel run tasks in parallel (WARNING! Be sure what you cause with this, e.g., 100 iperfs might not be good for a production environment)
	RunModeParallel RunMode = "parallel"
)

type RunOptions

type RunOptions struct {
	// Continue on error during test runs (recommended to set to `true`) (default is `true`)
	ContinueOnError *bool `yaml:"continueOnError,omitempty"`
	// Amount of test rounds (repetitions) to do for a test plan
	Rounds int `yaml:"rounds"`
	// Time interval to sleep / wait between (default `10s`)
	Interval time.Duration `yaml:"interval,omitempty"`
	// Run mode can be `parallel` or `sequential` (see `RunMode`, default is `sequential`)
	Mode RunMode `yaml:"mode"`
	// **NOT IMPLEMENTED YET** amount of test tasks to run when using `parallel` RunOptions.Mode
	ParallelCount int `yaml:"parallelCount"`
}

RunOptions options for running the tasks

func (*RunOptions) SetDefaults

func (c *RunOptions) SetDefaults()

SetDefaults set defaults on config part

type Runner

type Runner struct {
	// Name of the runner
	Name string `yaml:"name"`
	// Kubernetes runner options
	Kubernetes *RunnerKubernetes `yaml:"kubernetes"`
	// Ansible runner options
	Ansible *RunnerAnsible `yaml:"ansible"`
	// Mock runner options (userd for testing purposes)
	Mock *RunnerMock `yaml:"mock"`
}

Runner structure with all available runners config options

type RunnerAnsible

type RunnerAnsible struct {
	// InventoryFilePath Path to inventory file to use
	InventoryFilePath string `yaml:"inventoryFilePath"`
	// Groups server and clients group names
	Groups *AnsibleGroups `yaml:"groups"`
	// Path to the ansible command (if empty will be searched for in `PATH`)
	AnsibleCommand string `yaml:"ansibleCommand"`
	// Path to the ansible-inventory command (if empty will be searched for in `PATH`)
	AnsibleInventoryCommand string `yaml:"ansibleInventoryCommand"`
	// Timeout settings for ansible command runs
	Timeouts *AnsibleTimeouts `yaml:"timeouts"`
}

RunnerAnsible Ansible Runner config options

func (*RunnerAnsible) SetDefaults

func (c *RunnerAnsible) SetDefaults()

SetDefaults set defaults on config part

type RunnerKubernetes

type RunnerKubernetes struct {
	// If the Kubernetes client should use the in-cluster config for the cluster communication
	InClusterConfig bool `yaml:"inClusterConfig"`
	// Path to your kubeconfig file, if not set the following order will be tried out, `KUBECONFIG` and `$HOME/.kube/config`
	Kubeconfig string `yaml:"kubeconfig,omitempty"`
	// The image used for the spawned Pods for the tests (default `quay.io/galexrt/container-toolbox`)
	Image string `yaml:"image"`
	// Namespace to execute the tests in
	Namespace string `yaml:"namespace" validate:"max=63"`
	// If `hostNetwork` mode should be used for the test Pods
	HostNetwork *bool `yaml:"hostNetwork,omitempty"`
	// Timeout settings for operations against the Kubernetes API
	Timeouts *KubernetesTimeouts `yaml:"timeouts,omitempty"`
	// Annotations to put on the test Pods
	Annotations map[string]string `yaml:"annotations,omitempty"`
	// Host selection specific options
	Hosts *KubernetesHosts `yaml:"hosts"`
	// ServiceAccounst to use server and client Pods
	ServiceAccounts *KubernetesServiceAccounts `yaml:"serviceaccounts,omitempty"`
}

RunnerKubernetes Kubernetes Runner config options

func (*RunnerKubernetes) SetDefaults

func (c *RunnerKubernetes) SetDefaults()

SetDefaults set defaults on config part

type RunnerMock

type RunnerMock struct {
}

RunnerMock Mock Runner config options (here for good measure)

type SQLite

type SQLite struct {
	FilePath
	// Pattern used for templating the name of the table used in the SQLite database, the tables are created automatically
	TableNamePattern string `yaml:"tableNamePattern"`
}

SQLite SQLite Output config options

type Test

type Test struct {
	// Test name
	Name string `yaml:"name"`
	// The tester to use, e.g., for `iperf3` set to `iperf3` and so on
	Type string `yaml:"type"`
	// Options for the execution of the test
	RunOptions RunOptions `yaml:"runOptions"`
	// List of Outputs to use for processing data from the testers.
	Outputs []Output `yaml:"outputs"`
	// Hosts selection for client and server
	Hosts TestHosts `yaml:"hosts"`
	// IPerf3 test options
	IPerf3 *IPerf3 `yaml:"iperf3"`
}

Test Config options for each Test

type TestHosts

type TestHosts struct {
	// Static list of hosts to use as clients
	Clients []Hosts `yaml:"clients"`
	// Static list of hosts to use as server
	Servers []Hosts `yaml:"servers"`
}

TestHosts list of clients and servers hosts for use in the test(s)

Jump to

Keyboard shortcuts

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