This commit updates vmpooler to set configuration values received via environment variables to integer values when an integer value is expected. Without this change vmpooler does not support setting integer values via environment variables. Additionally, testing is added for configuring vmpooler via environment variables. To support this testing the gem climate_control is added, which allows for testing environment variables without those set variables leaking to other tests.
6.1 KiB
Configuring vmpooler
Vmpooler configuration can be provided via file or environment variable. Some configuration elements are unique to API or manager components. This document aims to describe options for providing vmpooler configuration via environment variables.
Table of contents
Global options
These options affect manager and API applications.
VMPOOLER_CONFIG
Provide the entire configuration as a blob of yaml. Individual parameters passed via environment variable will override any setting in this blob, or a configuration file passed in.
VMPOOLER_CONFIG_FILE
Path to a the file to use when loading the vmpooler configuration. This is only evaluated if VMPOOLER_CONFIG has not been specified.
DOMAIN
If set, returns a top-level 'domain' JSON key in POST requests (optional)
REDIS_SERVER
The redis server to use for vmpooler. (optional; default: 'localhost')
REDIS_PORT
The port to use when connecting to redis. (optional)
REDIS_PASSWORD
The password to use when connecting to redis. (optional)
REDIS_DATA_TTL
How long to keep data when set to expire in hours. (optional; default: 168)
STATSD_SERVER
The FQDN hostname of the statsd daemon. (optional)
STATSD_PREFIX
The prefix to use while storing statsd data. (optional; default: 'vmpooler')
STATSD_PORT
The UDP port to communicate with the statsd daemon. (optional; default: 8125)
GRAPHITE_SERVER
The FQDN hostname of the Graphite server. (optional)
GRAPHITE_PREFIX
The prefix to use while storing Graphite data. (optional; default: 'vmpooler')
GRAPHITE_PORT
The TCP port to communicate with the graphite server. (optional; default: 2003)
Manager options
TASK_LIMIT
The number of concurrent VM creation tasks to perform. Only affects manager. (optional; default: 10)
MIGRATION_LIMIT
When set to any value greater than 0 enable VM migration at checkout. When enabled this capability will evaluate a VM for migration to a different host when it is requested in an effort to maintain a more even distribution of load across compute resources. The number of migrations in progress at any one time are constrained by this value. (optional)
VM_CHECKTIME
How often (in minutes) to check the sanity of VMs in 'ready' queues. (optional; default: 15)
VM_LIFETIME
How long (in hours) to keep VMs in 'running' queues before destroying. (optional; default: 24)
VM_LIFETIME_AUTH
Same as vm_lifetime, but applied if a valid authentication token is
included during the request.
(required)
PREFIX
If set, prefixes all created VMs with this string. This should include a separator. (optional; default: '')
LOGFILE
The file to use for logging manager operations. (optional; default: '/var/log/vmpooler.log')
CLONE_TARGET
The target cluster VMs are cloned into (host with least VMs chosen) (optional; default: same cluster/host as origin template)
TIMEOUT
How long (in minutes) before marking a clone as 'failed' and retrying. (optional; default: 15)
MAX_TRIES
Set the max number of times a connection should retry in VM providers. This optional setting allows a user to dial in retry limits to suit your environment. (optional; default: 3)
RETRY_FACTOR
When retrying, each attempt sleeps for the try count * retry_factor. Increase this number to lengthen the delay between retry attempts. This is particularly useful for instances with a large number of pools to prevent a thundering herd when retrying connections. (optional; default: 10)
CREATE_FOLDERS
Create the pool folder specified in the pool configuration. Note: this will only create the last folder when it does not exist. It will not create any parent folders. (optional; default: false)
CREATE_TEMPLATE_DELTA_DISKS
Create backing delta disks for the specified templates to support creating linked clones. (optional; default: false)
PURGE_UNCONFIGURED_FOLDERS
Enable purging of VMs and folders detected within the base folder path that are not configured for the provider Only a single layer of folders and their child VMs are evaluated from detected base folder paths A base folder path for 'vmpooler/redhat-7' would be 'vmpooler' When enabled in the global configuration then purging is enabled for all providers Expects a boolean value (optional; default: false)
USAGE_STATS
Enable shipping of VM usage stats When enabled a metric is emitted when a machine is destroyed. Tags are inspected and used to organize shipped metrics if there is a jenkins_build_url tag set for the VM. Without the jenkins_build_url tag set the metric will be sent as "usage.$user.$pool_name". When the jenkins_build_url tag is set the metric will be sent with additional data. Here is an example based off of the following URL; https://jenkins.example.com/job/platform_puppet-agent-extra_puppet-agent-integration-suite_pr/RMM_COMPONENT_TO_TEST_NAME=puppet,SLAVE_LABEL=beaker,TEST_TARGET=redhat7-64a/824/ "usage.$user.$instance.$value_stream.$branch.$project.$job_name.$component_to_test.$pool_name", which translates to "usage.$user.jenkins_example_com.platform.pr.puppet-agent-extra.puppet-agent-integration-suite.puppet.$pool_name" Expects a boolean value (optional; default: false)
API options
AUTH_PROVIDER
The provider to use for authentication. (optional)
LDAP_HOST
The FQDN hostname of the LDAP server. (optional)
LDAP_PORT
The port used to connect to the LDAP service. (optional; default: 389)
LDAP_BASE
The base DN used for LDAP searches. This can be a string providing a single DN. For multiple DNs please specify the DNs as an array in a configuration file. (optional)
LDAP_USER_OBJECT
The LDAP object-type used to designate a user object. (optional)
SITE_NAME
The name of your deployment. (optional; default: 'vmpooler')
EXPERIMENTAL_FEATURES
Enable experimental API capabilities such as changing pool template and size without application restart Expects a boolean value (optional; default: false)