config

package
v4.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 20

Documentation

Overview

Package config defines configuration structures

Index

Constants

View Source
const DefaultAnsibleJobMonInterval = 15 * time.Second

DefaultAnsibleJobMonInterval is the default monitoring interval for Jobs handled by Ansible

View Source
const DefaultArchiveArtifacts = false

DefaultArchiveArtifacts is set to false by default. When ArchiveArtifacts is true, destination hosts need tar to be installed, to be able to unarchive artifacts.

View Source
const DefaultCacheFacts = false

DefaultCacheFacts is set to false by default, meaning ansible facts are not cached by default

View Source
const DefaultConsulPubMaxRoutines int = 500

DefaultConsulPubMaxRoutines is the default maximum number of parallel goroutines used to store keys/values in Consul

See consulutil package for more details

View Source
const DefaultConsulTLSHandshakeTimeout = 50 * time.Second

DefaultConsulTLSHandshakeTimeout is the default maximum duration to wait for a TLS handshake. See consulutil package for more details

View Source
const DefaultHTTPAddress string = "0.0.0.0"

DefaultHTTPAddress is the default listening address for the HTTP REST API

View Source
const DefaultHTTPPort int = 8800

DefaultHTTPPort is the default port number for the HTTP REST API

View Source
const DefaultKeepOperationRemotePath = false

DefaultKeepOperationRemotePath is set to false by default in order to remove path created to store operation artifacts on nodes.

View Source
const DefaultPluginDir = "plugins"

DefaultPluginDir is the default path for the plugin directory

View Source
const DefaultPurgedDeploymentsEvictionTimeout = 30 * time.Minute

DefaultPurgedDeploymentsEvictionTimeout is the default timeout after which final events and logs for a purged deployment are actually deleted.

View Source
const DefaultSSHConnectionMaxRetries uint64 = 3

DefaultSSHConnectionMaxRetries is the default maximum number of retries before giving up (number of attempts is number of retries + 1)

View Source
const DefaultSSHConnectionRetryBackoff = 1 * time.Second

DefaultSSHConnectionRetryBackoff is the default duration before retring connect for SSH connections

View Source
const DefaultSSHConnectionTimeout = 10 * time.Second

DefaultSSHConnectionTimeout is the default timeout for SSH connections

View Source
const DefaultServerGracefulShutdownTimeout = 5 * time.Minute

DefaultServerGracefulShutdownTimeout is the default timeout for a graceful shutdown of a Yorc server before exiting

View Source
const DefaultTasksDispatcherLockWaitTime = 50 * time.Millisecond

DefaultTasksDispatcherLockWaitTime is the default wait time for acquiring a lock for an execution task

View Source
const DefaultTasksDispatcherLongPollWaitTime = 1 * time.Minute

DefaultTasksDispatcherLongPollWaitTime is the default wait time when long polling for executions tasks to dispatch to workers

View Source
const DefaultTasksDispatcherMetricsRefreshTime = 5 * time.Minute

DefaultTasksDispatcherMetricsRefreshTime is the default refresh time for the Tasks dispatcher metrics

View Source
const DefaultUpgradesConcurrencyLimit = 1000

DefaultUpgradesConcurrencyLimit is the default limit of concurrency used in Upgrade processes

View Source
const DefaultWfStepGracefulTerminationTimeout = 2 * time.Minute

DefaultWfStepGracefulTerminationTimeout is the default timeout for a graceful termination of a workflow step during concurrent workflow step failure

View Source
const DefaultWorkersNumber int = 30

DefaultWorkersNumber is the default number of workers in the Yorc server

Variables

This section is empty.

Functions

This section is empty.

Types

type Ansible

type Ansible struct {
	UseOpenSSH              bool                         `yaml:"use_openssh,omitempty" mapstructure:"use_openssh" json:"use_open_ssh,omitempty"`
	DebugExec               bool                         `yaml:"debug,omitempty" mapstructure:"debug" json:"debug_exec,omitempty"`
	ConnectionRetries       int                          `yaml:"connection_retries,omitempty" mapstructure:"connection_retries" json:"connection_retries,omitempty"`
	OperationRemoteBaseDir  string                       `` /* 126-byte string literal not displayed */
	KeepOperationRemotePath bool                         `` /* 129-byte string literal not displayed */
	KeepGeneratedRecipes    bool                         `yaml:"keep_generated_recipes,omitempty" mapstructure:"keep_generated_recipes" json:"keep_generated_recipes,omitempty"`
	ArchiveArtifacts        bool                         `yaml:"archive_artifacts,omitempty" mapstructure:"archive_artifacts" json:"archive_artifacts,omitempty"`
	CacheFacts              bool                         `yaml:"cache_facts,omitempty" mapstructure:"cache_facts" json:"cache_facts,omitempty"`
	HostedOperations        HostedOperations             `yaml:"hosted_operations,omitempty" mapstructure:"hosted_operations" json:"hosted_operations,omitempty"`
	JobsChecksPeriod        time.Duration                `` /* 135-byte string literal not displayed */
	Config                  map[string]map[string]string `yaml:"config,omitempty" mapstructure:"config"`
	Inventory               map[string][]string          `yaml:"inventory,omitempty" mapstructure:"inventory"`
}

Ansible configuration

type Client

type Client struct {
	YorcAPI       string `mapstructure:"yorc_api"`
	SSLEnabled    bool   `mapstructure:"ssl_enabled"`
	SkipTLSVerify bool   `mapstructure:"skip_tls_verify"`
	KeyFile       string `mapstructure:"key_file"`
	CertFile      string `mapstructure:"cert_file"`
	CAFile        string `mapstructure:"ca_file"`
	CAPath        string `mapstructure:"ca_path"`
}

Client holds config information filled by Cobra and Viper (see commands package for more information) for the CLI (in short not the server) part of Yorc

type Configuration

type Configuration struct {
	Ansible                          Ansible       `yaml:"ansible,omitempty" mapstructure:"ansible"`
	PluginsDirectory                 string        `yaml:"plugins_directory,omitempty" mapstructure:"plugins_directory"`
	WorkingDirectory                 string        `yaml:"working_directory,omitempty" mapstructure:"working_directory"`
	WorkersNumber                    int           `yaml:"workers_number,omitempty" mapstructure:"workers_number"`
	ServerGracefulShutdownTimeout    time.Duration `yaml:"server_graceful_shutdown_timeout,omitempty" mapstructure:"server_graceful_shutdown_timeout"`
	HTTPPort                         int           `yaml:"http_port,omitempty" mapstructure:"http_port"`
	HTTPAddress                      string        `yaml:"http_address,omitempty" mapstructure:"http_address"`
	KeyFile                          string        `yaml:"key_file,omitempty" mapstructure:"key_file"`
	CertFile                         string        `yaml:"cert_file,omitempty" mapstructure:"cert_file"`
	CAFile                           string        `yaml:"ca_file,omitempty" mapstructure:"ca_file"`
	CAPath                           string        `yaml:"ca_path,omitempty" mapstructure:"ca_path"`
	SSLVerify                        bool          `yaml:"ssl_verify,omitempty" mapstructure:"ssl_verify"`
	ResourcesPrefix                  string        `yaml:"resources_prefix,omitempty" mapstructure:"resources_prefix"`
	Consul                           Consul        `yaml:"consul,omitempty" mapstructure:"consul"`
	Telemetry                        Telemetry     `yaml:"telemetry,omitempty" mapstructure:"telemetry"`
	LocationsFilePath                string        `yaml:"locations_file_path,omitempty" mapstructure:"locations_file_path"`
	Vault                            DynamicMap    `yaml:"vault,omitempty" mapstructure:"vault"`
	WfStepGracefulTerminationTimeout time.Duration `yaml:"wf_step_graceful_termination_timeout,omitempty" mapstructure:"wf_step_graceful_termination_timeout"`
	PurgedDeploymentsEvictionTimeout time.Duration `yaml:"purged_deployments_eviction_timeout,omitempty" mapstructure:"purged_deployments_eviction_timeout"`
	ServerID                         string        `yaml:"server_id,omitempty" mapstructure:"server_id"`
	Terraform                        Terraform     `yaml:"terraform,omitempty" mapstructure:"terraform"`
	DisableSSHAgent                  bool          `yaml:"disable_ssh_agent,omitempty" mapstructure:"disable_ssh_agent"`
	Tasks                            Tasks         `yaml:"tasks,omitempty" mapstructure:"tasks"`
	Storage                          Storage       `yaml:"storage,omitempty" mapstructure:"storage"`
	UpgradeConcurrencyLimit          int           `yaml:"concurrency_limit_for_upgrades,omitempty" mapstructure:"concurrency_limit_for_upgrades"`
	SSHConnectionTimeout             time.Duration `yaml:"ssh_connection_timeout,omitempty" mapstructure:"ssh_connection_timeout"`
	SSHConnectionRetryBackoff        time.Duration `yaml:"ssh_connection_retry_backoff,omitempty" mapstructure:"ssh_connection_retry_backoff"`
	SSHConnectionMaxRetries          uint64        `yaml:"ssh_connection_max_retries,omitempty" mapstructure:"ssh_connection_max_retries"`
}

Configuration holds config information filled by Cobra and Viper (see commands package for more information)

func (Configuration) GetConsulClient

func (cfg Configuration) GetConsulClient() (*api.Client, error)

GetConsulClient returns the Consul client singleton instance from a given Configuration

func (Configuration) GetNewConsulClient

func (cfg Configuration) GetNewConsulClient() (*api.Client, error)

GetNewConsulClient returns a Consul client instance from a given Configuration used for plugin, tests but no for server runtime needs For standard server runtime need, use the GetConsulClient which returns a singleton

type Consul

type Consul struct {
	Token               string        `yaml:"token,omitempty" mapstructure:"token"`
	Datacenter          string        `yaml:"datacenter,omitempty" mapstructure:"datacenter"`
	Address             string        `yaml:"address,omitempty" mapstructure:"address"`
	Key                 string        `yaml:"key_file,omitempty" mapstructure:"key_file"`
	Cert                string        `yaml:"cert_file,omitempty" mapstructure:"cert_file"`
	CA                  string        `yaml:"ca_cert,omitempty" mapstructure:"ca_cert"`
	CAPath              string        `yaml:"ca_path,omitempty" mapstructure:"ca_path"`
	SSL                 bool          `yaml:"ssl,omitempty" mapstructure:"ssl"`
	SSLVerify           bool          `yaml:"ssl_verify,omitempty" mapstructure:"ssl_verify"`
	PubMaxRoutines      int           `yaml:"publisher_max_routines,omitempty" mapstructure:"publisher_max_routines"`
	TLSHandshakeTimeout time.Duration `yaml:"tls_handshake_timeout,omitempty" mapstructure:"tls_handshake_timeout"`
}

Consul configuration

type Dispatcher

type Dispatcher struct {
	LongPollWaitTime   time.Duration `yaml:"long_poll_wait_time,omitempty" mapstructure:"long_poll_wait_time" json:"long_poll_wait_time,omitempty"`
	LockWaitTime       time.Duration `yaml:"lock_wait_time,omitempty" mapstructure:"lock_wait_time" json:"lock_wait_time,omitempty"`
	MetricsRefreshTime time.Duration `yaml:"metrics_refresh_time,omitempty" mapstructure:"metrics_refresh_time" json:"metrics_refresh_time,omitempty"`
}

Dispatcher configuration

type DockerSandbox

type DockerSandbox struct {
	Image      string   `mapstructure:"image"`
	Command    []string `mapstructure:"command"`
	Entrypoint []string `mapstructure:"entrypoint"`
	Env        []string `mapstructure:"env"`
}

DockerSandbox holds the configuration for a docker sandbox

type DynamicMap

type DynamicMap map[string]interface{}

DynamicMap allows to store configuration parameters that are not known in advance. This is particularly useful when configuration parameters may be defined in a plugin such for locations.

It has methods to automatically cast data to the desired type.

func (DynamicMap) Get

func (dm DynamicMap) Get(name string) interface{}

Get returns the raw value of a given configuration key

func (DynamicMap) GetBool

func (dm DynamicMap) GetBool(name string) bool

GetBool returns the value of the given key casted into a boolean. False is returned if not found.

func (DynamicMap) GetDuration

func (dm DynamicMap) GetDuration(name string) time.Duration

GetDuration returns the value of the given key casted into a Duration. A 0 duration is returned if not found.

func (DynamicMap) GetDurationOrDefault added in v4.0.4

func (dm DynamicMap) GetDurationOrDefault(name string, defaultValue time.Duration) time.Duration

GetDurationOrDefault returns the value of the given key casted into a Duration. The given default value is returned if not found.

func (DynamicMap) GetInt

func (dm DynamicMap) GetInt(name string) int

GetInt returns the value of the given key casted into an int. 0 is returned if not found.

func (DynamicMap) GetInt64

func (dm DynamicMap) GetInt64(name string) int64

GetInt64 returns the value of the given key casted into an int64. 0 is returned if not found.

func (DynamicMap) GetInt64OrDefault added in v4.0.4

func (dm DynamicMap) GetInt64OrDefault(name string, defaultValue int64) int64

GetInt64OrDefault returns the value of the given key casted into an int64. The given default value is returned if not found.

func (DynamicMap) GetIntOrDefault added in v4.0.2

func (dm DynamicMap) GetIntOrDefault(name string, defaultValue int) int

GetIntOrDefault returns the value of the given key casted into an int. The given default value is returned if not found.

func (DynamicMap) GetString

func (dm DynamicMap) GetString(name string) string

GetString returns the value of the given key casted into a string. An empty string is returned if not found.

func (DynamicMap) GetStringOrDefault

func (dm DynamicMap) GetStringOrDefault(name, defaultValue string) string

GetStringOrDefault returns the value of the given key casted into a string. The given default value is returned if not found or not a valid string.

func (DynamicMap) GetStringSlice

func (dm DynamicMap) GetStringSlice(name string) []string

GetStringSlice returns the value of the given key casted into a slice of string. If the corresponding raw value is a string, it is split on comas. A nil or empty slice is returned if not found.

func (DynamicMap) GetUint64 added in v4.0.4

func (dm DynamicMap) GetUint64(name string) uint64

GetUint64 returns the value of the given key casted into an uint64. 0 is returned if not found.

func (DynamicMap) GetUint64OrDefault added in v4.0.4

func (dm DynamicMap) GetUint64OrDefault(name string, defaultValue uint64) uint64

GetUint64OrDefault returns the value of the given key casted into an uint64. The given default value is returned if not found.

func (DynamicMap) IsSet

func (dm DynamicMap) IsSet(name string) bool

IsSet checks if a given configuration key is defined

func (DynamicMap) Keys

func (dm DynamicMap) Keys() []string

Keys returns registered keys in the dynamic map

func (DynamicMap) Set

func (dm DynamicMap) Set(name string, value interface{})

Set sets a value for a given key

type HostedOperations

type HostedOperations struct {
	UnsandboxedOperationsAllowed bool           `mapstructure:"unsandboxed_operations_allowed"`
	DefaultSandbox               *DockerSandbox `mapstructure:"default_sandbox"`
}

HostedOperations holds the configuration for operations executed on the orechestrator host (eg. with an operation_host equals to ORECHESTRATOR)

func (HostedOperations) Format

func (ho HostedOperations) Format(s fmt.State, verb rune)

Format implements fmt.Formatter to provide a custom formatter.

type Storage

type Storage struct {
	Reset             bool       `yaml:"reset,omitempty" json:"reset,omitempty" mapstructure:"reset"`
	Stores            []Store    `yaml:"stores,omitempty" json:"stores,omitempty" mapstructure:"stores"`
	DefaultProperties DynamicMap `yaml:"default_properties,omitempty" json:"default_properties,omitempty" mapstructure:"default_properties"`
}

Storage configuration

type Store

type Store struct {
	Name                  string     `yaml:"name" json:"name" mapstructure:"name"`
	MigrateDataFromConsul bool       `yaml:"migrate_data_from_consul,omitempty" json:"migrate_data_from_consul,omitempty"  mapstructure:"migrate_data_from_consul"`
	Implementation        string     `yaml:"implementation" json:"implementation" mapstructure:"implementation"` // not an enum as it may be extended by plugins
	Types                 []string   `yaml:"types" json:"types" mapstructure:"types"`
	Properties            DynamicMap `yaml:"properties,omitempty" json:"properties,omitempty" mapstructure:"properties"`
}

Store configuration

type Tasks

type Tasks struct {
	Dispatcher Dispatcher `yaml:"dispatcher,omitempty" mapstructure:"dispatcher" json:"dispatcher,omitempty"`
}

Tasks processing configuration

type Telemetry

type Telemetry struct {
	StatsdAddress           string `yaml:"statsd_address,omitempty" mapstructure:"statsd_address"`
	StatsiteAddress         string `yaml:"statsite_address,omitempty" mapstructure:"statsite_address"`
	PrometheusEndpoint      bool   `yaml:"expose_prometheus_endpoint,omitempty" mapstructure:"expose_prometheus_endpoint"`
	ServiceName             string `yaml:"service_name,omitempty" mapstructure:"service_name"`
	DisableHostName         bool   `yaml:"disable_hostname,omitempty" mapstructure:"disable_hostname"`
	DisableGoRuntimeMetrics bool   `yaml:"disable_go_runtime_metrics,omitempty" mapstructure:"disable_go_runtime_metrics"`
}

Telemetry holds the configuration for the telemetry service

type TemplateResolver

type TemplateResolver interface {
	// SetTemplatesFunctions allows to define custom template functions
	SetTemplatesFunctions(fm template.FuncMap)
	// ResolveValueWithTemplates resolves a template
	ResolveValueWithTemplates(key string, value interface{}) interface{}
	// Disable allows to disable configuration templates usage
	Disable()
	// Enable allows to enable configuration templates usage
	Enable()
}

TemplateResolver allows to resolve templates in DynamicMap

var DefaultConfigTemplateResolver TemplateResolver = &configTemplateResolver{}

DefaultConfigTemplateResolver is the default resolver for configuration templates

type Terraform

type Terraform struct {
	PluginsDir                       string `yaml:"plugins_dir,omitempty" mapstructure:"plugins_dir"`
	ConsulPluginVersionConstraint    string `yaml:"consul_plugin_version_constraint,omitempty" mapstructure:"consul_plugin_version_constraint"`
	AWSPluginVersionConstraint       string `yaml:"aws_plugin_version_constraint,omitempty" mapstructure:"aws_plugin_version_constraint"`
	GooglePluginVersionConstraint    string `yaml:"google_plugin_version_constraint,omitempty" mapstructure:"google_plugin_version_constraint"`
	OpenStackPluginVersionConstraint string `yaml:"openstack_plugin_version_constraint,omitempty" mapstructure:"openstack_plugin_version_constraint"`
	KeepGeneratedFiles               bool   `yaml:"keep_generated_files,omitempty" mapstructure:"keep_generated_files"`
}

Terraform configuration

Jump to

Keyboard shortcuts

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