config

package
v3.1.0-M2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config defines configuration structures

Index

Constants

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 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 DefaultServerGracefulShutdownTimeout = 5 * time.Minute

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

View Source
const DefaultServerID = "server_0"

DefaultServerID is the default server ID used to identify the server node in a cluster

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 = 3

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             `mapstructure:"use_openssh"`
	DebugExec               bool             `mapstructure:"debug"`
	ConnectionRetries       int              `mapstructure:"connection_retries"`
	OperationRemoteBaseDir  string           `mapstructure:"operation_remote_base_dir"`
	KeepOperationRemotePath bool             `mapstructure:"keep_operation_remote_path"`
	ArchiveArtifacts        bool             `mapstructure:"archive_artifacts"`
	CacheFacts              bool             `mapstructure:"cache_facts"`
	HostedOperations        HostedOperations `mapstructure:"hosted_operations"`
}

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               `mapstructure:"ansible"`
	PluginsDirectory                 string                `mapstructure:"plugins_directory"`
	WorkingDirectory                 string                `mapstructure:"working_directory"`
	WorkersNumber                    int                   `mapstructure:"workers_number"`
	ServerGracefulShutdownTimeout    time.Duration         `mapstructure:"server_graceful_shutdown_timeout"`
	HTTPPort                         int                   `mapstructure:"http_port"`
	HTTPAddress                      string                `mapstructure:"http_address"`
	KeyFile                          string                `mapstructure:"key_file"`
	CertFile                         string                `mapstructure:"cert_file"`
	CAFile                           string                `mapstructure:"ca_file"`
	CAPath                           string                `mapstructure:"ca_path"`
	SSLVerify                        bool                  `mapstructure:"ssl_verify"`
	ResourcesPrefix                  string                `mapstructure:"resources_prefix"`
	Consul                           Consul                `mapstructure:"consul"`
	Telemetry                        Telemetry             `mapstructure:"telemetry"`
	Infrastructures                  map[string]DynamicMap `mapstructure:"infrastructures"`
	Vault                            DynamicMap            `mapstructure:"vault"`
	WfStepGracefulTerminationTimeout time.Duration         `mapstructure:"wf_step_graceful_termination_timeout"`
	ServerID                         string                `mapstructure:"server_id"`
}

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 `mapstructure:"token"`
	Datacenter     string `mapstructure:"datacenter"`
	Address        string `mapstructure:"address"`
	Key            string `mapstructure:"key_file"`
	Cert           string `mapstructure:"cert_file"`
	CA             string `mapstructure:"ca_cert"`
	CAPath         string `mapstructure:"ca_path"`
	SSL            bool   `mapstructure:"ssl"`
	SSLVerify      bool   `mapstructure:"ssl_verify"`
	PubMaxRoutines int    `mapstructure:"publisher_max_routines"`
}

Consul 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 infrastructures.

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) 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) 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) 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 Telemetry

type Telemetry struct {
	StatsdAddress           string `mapstructure:"statsd_address"`
	StatsiteAddress         string `mapstructure:"statsite_address"`
	PrometheusEndpoint      bool   `mapstructure:"expose_prometheus_endpoint"`
	ServiceName             string `mapstructure:"service_name"`
	DisableHostName         bool   `mapstructure:"disable_hostname"`
	DisableGoRuntimeMetrics bool   `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{}
}

TemplateResolver allows to resolve templates in DynamicMap

var DefaultConfigTemplateResolver TemplateResolver = &configTemplateResolver{}

DefaultConfigTemplateResolver is the default resolver for configuration templates

Jump to

Keyboard shortcuts

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