config

package
v3.2.4 Latest Latest
Warning

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

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

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

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

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"`
	Infrastructures                  map[string]DynamicMap `yaml:"infrastructures,omitempty" mapstructure:"infrastructures"`
	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"`
}

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 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 `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{}
}

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