Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Modes = map[string]string{
"ent": "Nomad Autoscaler Enterprise",
}
Modes stores the different capability modes of the Nomad Autoscaler.
var ModesEnabled = []string{}
ModesEnabled lists the modes that are allowed to be used. With !ent build no special modes are allowed.
Functions ¶
func NewModeChecker ¶ added in v0.3.1
NewModeChecker returns a new mode checker.
Types ¶
type Agent ¶
type Agent struct { // LogLevel is the level of the logs to emit. LogLevel string `hcl:"log_level,optional"` // LogJson enables log output in JSON format. LogJson bool `hcl:"log_json,optional"` // LogIncludeLocation dictates whether the logger includes file and line // information on each log line. This is useful for development and // debugging. LogIncludeLocation bool `hcl:"log_include_location,optional"` // EnableDebug is used to enable debugging HTTP endpoints. EnableDebug bool `hcl:"enable_debug,optional"` // PluginDir is the directory that holds the autoscaler plugin binaries. PluginDir string `hcl:"plugin_dir,optional"` // DynamicApplicationSizing is the configuration for the components used // in Dynamic Application Sizing. DynamicApplicationSizing *DynamicApplicationSizing `hcl:"dynamic_application_sizing,block" modes:"ent"` // HTTP is the configuration used to setup the HTTP health server. HTTP *HTTP `hcl:"http,block"` // Nomad is the configuration used to setup the Nomad client. Nomad *Nomad `hcl:"nomad,block"` // Policy is the configuration used to setup the policy manager. Policy *Policy `hcl:"policy,block"` // PolicyWorkers is the configuration used to define the number of workers // to start for each policy type. PolicyEval *PolicyEval `hcl:"policy_eval,block"` // Telemetry is the configuration used to setup metrics collection. Telemetry *Telemetry `hcl:"telemetry,block"` // HighAvailability is the configuration used for the leader election. HighAvailability *HighAvailability `hcl:"high_availability,block"` APMs []*Plugin `hcl:"apm,block"` Targets []*Plugin `hcl:"target,block"` Strategies []*Plugin `hcl:"strategy,block"` }
Agent is the overall configuration of an autoscaler agent and includes all required information for it to start successfully.
All time.Duration values should have two parts:
- a string field tagged with an hcl:"foo" and json:"-"
- a time.Duration field in the same struct which is populated within the parseFile if the HCL param is populated.
The string reference of a duration can include "ns", "us" (or "µs"), "ms", "s", "m", "h" suffixes.
func DefaultEntConfig ¶ added in v0.2.0
func DefaultEntConfig() *Agent
DefaultEntConfig allows configuring enterprise only default configuration values.
func Load ¶
Load loads the configuration at the given path, regardless if its a file or directory. Called for each -config to build up the runtime config value.
type DynamicApplicationSizing ¶ added in v0.3.1
type DynamicApplicationSizing struct { // MetricsPreloadThreshold is the limit for how much historical data to // preload when the Autoscaler starts. MetricsPreloadThreshold time.Duration MetricsPreloadThresholdHCL string `hcl:"metrics_preload_threshold,optional" json:"-"` // EvaluateAfter is the time limit for how much historical data must be // available before the Autoscaler evaluates a policy. EvaluateAfter time.Duration EvaluateAfterHCL string `hcl:"evaluate_after,optional" json:"-"` // NamespaceLabel is the label used by the APM to store the namespace of a job. NamespaceLabel string `hcl:"namespace_label,optional"` // JobLabel is the label used by the APM to store the ID of a job. JobLabel string `hcl:"job_label,optional"` // GroupLabel is the label used by the APM to store the name of a group. GroupLabel string `hcl:"group_label,optional"` // TaskLabel is the label used by the APM to store the name of a task. TaskLabel string `hcl:"task_label,optional"` // CPUMetric is the metric used to query historical CPU usage. CPUMetric string `hcl:"cpu_metric,optional"` // MemoryMetric is the metric used to query historical memory usage. MemoryMetric string `hcl:"memory_metric,optional"` }
DynamicApplicationSizing contains configuration values to control the components used for Dynamic Application Sizing.
type HTTP ¶
type HTTP struct { // BindAddress is the tcp address to bind to. BindAddress string `hcl:"bind_address,optional"` // BindPort is the port used to run the HTTP server. BindPort int `hcl:"bind_port,optional"` }
HTTP contains all configuration details for the running of the agent HTTP health server.
type HighAvailability ¶ added in v0.4.0
type HighAvailability struct { // Enable starts the agent in high availability mode, where the agent instance // attempts to hold a lock over a variable and will only execute if the lock // is successfully acquired. Enabled *bool `hcl:"enabled"` // LockNamespace defines the namespace where the high availability lock // variable is written. LockNamespace string `hcl:"lock_namespace,optional" json:"-"` // LockPath defines the path of the variable that will be used to sync the // leader when running on high availability mode. LockPath string `hcl:"lock_path,optional" json:"-"` // Lock ttl defines the lease period or ttl of the lock used to sync the // leader when running on high availability mode. LockTTLHCL string `hcl:"lock_ttl,optional" json:"-"` LockTTL time.Duration // Lock delay defines the period the lock used used to sync the // leader when running on high availability mode will be unattainable if its // not renewed or release properly. LockDelayHCL string `hcl:"lock_delay,optional" json:"-"` LockDelay time.Duration }
type Nomad ¶
type Nomad struct { // Address is the address of the Nomad agent. Address string `hcl:"address,optional"` // Region to use. Region string `hcl:"region,optional"` // Namespace to use. Namespace string `hcl:"namespace,optional"` // Token is the SecretID of an ACL token to use to authenticate API // requests with. Token string `hcl:"token,optional"` // HTTPAuth is the auth info to use for http access. HTTPAuth string `hcl:"http_auth,optional"` // CACert is the path to a PEM-encoded CA cert file to use to verify the // Nomad server SSL certificate. CACert string `hcl:"ca_cert,optional"` // CAPath is the path to a directory of PEM-encoded CA cert files to verify // the Nomad server SSL certificate. CAPath string `hcl:"ca_path,optional"` // ClientCert is the path to the certificate for Nomad communication. ClientCert string `hcl:"client_cert,optional"` // ClientKey is the path to the private key for Nomad communication. ClientKey string `hcl:"client_key,optional"` // TLSServerName, if set, is used to set the SNI host when connecting via // TLS. TLSServerName string `hcl:"tls_server_name,optional"` // SkipVerify enables or disables SSL verification. SkipVerify bool `hcl:"skip_verify,optional"` // BlockQueryWaitTime controls how long Nomad API requests supporting blocking queries // are held open. Defaults to 5m. BlockQueryWaitTime time.Duration BlockQueryWaitTimeHCL string `hcl:"block_query_wait_time,optional"` }
Nomad holds the user specified configuration for connectivity to the Nomad API.
type Plugin ¶
type Plugin struct { Name string `hcl:"name,label"` Driver string `hcl:"driver"` Args []string `hcl:"args,optional"` Config map[string]string `hcl:"config,optional"` }
Plugin is an individual configured plugin and holds all the required params to successfully dispense the driver.
type Policy ¶
type Policy struct { // Dir is the directory which contains scaling policies to be loaded from // disk. This currently only supports cluster scaling policies. Dir string `hcl:"dir,optional"` // DefaultCooldown is the default cooldown parameter added to all policies // which do not explicitly configure the parameter. DefaultCooldown time.Duration DefaultCooldownHCL string `hcl:"default_cooldown,optional"` // DefaultEvaluationInterval is the time duration interval used when // `evaluation_interval` is not defined in a policy. DefaultEvaluationInterval time.Duration DefaultEvaluationIntervalHCL string `hcl:"default_evaluation_interval,optional" json:"-"` // Sources store configuration for policy sources. Sources []*PolicySource `hcl:"source,block"` }
Policy holds the configuration information specific to the policy manager and resulting policy parsing.
type PolicyEval ¶ added in v0.2.0
type PolicyEval struct { // DeliveryLimit is the maxmimum number of times a policy evaluation can // be dequeued from the broker. DeliveryLimitPtr *int `hcl:"delivery_limit,optional"` DeliveryLimit int // AckTimeout is the time limit that an eval must be ACK'd before being // considered NACK'd. AckTimeout time.Duration AckTimeoutHCL string `hcl:"ack_timeout,optional" json:"-"` // Workers hold the number of workers to initialize for each queue. Workers map[string]int `hcl:"workers,optional"` }
PolicyEval holds the configuration related to the policy evaluation process.
type PolicySource ¶ added in v0.3.4
PolicySource is an individual configured policy source.
type Telemetry ¶ added in v0.1.1
type Telemetry struct { // PrometheusRetentionTime is the retention time for prometheus metrics if // greater than 0. PrometheusRetentionTime time.Duration PrometheusRetentionTimeHCL string `hcl:"prometheus_retention_time,optional" json:"-"` // PrometheusMetrics specifies whether the agent should make Prometheus // formatted metrics available. PrometheusMetrics bool `hcl:"prometheus_metrics,optional"` // DisableHostname specifies if gauge values should be prefixed with the // local hostname. DisableHostname bool `hcl:"disable_hostname,optional"` // EnableHostnameLabel adds the hostname as a label on all metrics. EnableHostnameLabel bool `hcl:"enable_hostname_label,optional"` // CollectionInterval specifies the time interval at which the agent // collects telemetry data. CollectionInterval time.Duration CollectionIntervalHCL string `hcl:"collection_interval,optional" json:"-"` // StatsiteAddr specifies the address of a statsite server to forward // metrics data to. StatsiteAddr string `hcl:"statsite_address,optional"` // StatsdAddr specifies the address of a statsd server to forward metrics // to. StatsdAddr string `hcl:"statsd_address,optional"` // DogStatsDAddr specifies the address of a DataDog statsd server to // forward metrics to. DogStatsDAddr string `hcl:"dogstatsd_address,optional"` // DogStatsDTags specifies a list of global tags that will be added to all // telemetry packets sent to DogStatsD. DogStatsDTags []string `hcl:"dogstatsd_tags,optional"` // CirconusAPIToken is a valid API Token used to create/manage check. If // provided, metric management is enabled. Defaults to none. CirconusAPIToken string `hcl:"circonus_api_token,optional"` // CirconusAPIApp is an app name associated with API token. Defaults to // "nomad_autoscaler". CirconusAPIApp string `hcl:"circonus_api_app,optional"` // CirconusAPIURL is the base URL to use for contacting the Circonus API. // Defaults to "https://api.circonus.com/v2". CirconusAPIURL string `hcl:"circonus_api_url,optional"` // CirconusSubmissionInterval is the interval at which metrics are // submitted to Circonus. Defaults to 10s. CirconusSubmissionInterval string `hcl:"circonus_submission_interval,optional"` // CirconusCheckSubmissionURL is the check.config.submission_url field from // a previously created HTTPTRAP check. Defaults to none. CirconusCheckSubmissionURL string `hcl:"circonus_submission_url,optional"` // CirconusCheckID is the check id (not check bundle id) from a previously // created HTTPTRAP check. The numeric portion of the check._cid field. // Defaults to none. CirconusCheckID string `hcl:"circonus_check_id,optional"` // CirconusCheckForceMetricActivation will force enabling metrics, as they // are encountered, if the metric already exists and is NOT active. If // check management is enabled, the default behavior is to add new metrics // as they are encountered. If the metric already exists in the check, it // will *NOT* be activated. This setting overrides that behavior. Defaults // to "false". CirconusCheckForceMetricActivation string `hcl:"circonus_check_force_metric_activation,optional"` // CirconusCheckInstanceID serves to uniquely identify the metrics coming // from this "instance". It can be used to maintain metric continuity with // transient or ephemeral instances as they move around within an // infrastructure. Defaults to hostname:app. CirconusCheckInstanceID string `hcl:"circonus_check_instance_id,optional"` // CirconusCheckSearchTag is a special tag which, when coupled with the // instance id, helps to narrow down the search results when neither a // Submission URL or Check ID is provided. Defaults to service:app. CirconusCheckSearchTag string `hcl:"circonus_check_search_tag,optional"` // CirconusCheckTags is a comma separated list of tags to apply to the // check. Note that the value of CirconusCheckSearchTag will always be // added to the check. Defaults to none. CirconusCheckTags string `hcl:"circonus_check_tags,optional"` // CirconusCheckDisplayName is the name for the check which will be // displayed in the Circonus UI. Defaults to the value of // CirconusCheckInstanceID. CirconusCheckDisplayName string `hcl:"circonus_check_display_name,optional"` // CirconusBrokerID is an explicit broker to use when creating a new check. // The numeric portion of broker._cid. If metric management is enabled and // neither a Submission URL nor Check ID is provided, an attempt will be // made to search for an existing check using Instance ID and Search Tag. // If one is not found, a new HTTPTRAP check will be created. Default: use // Select Tag if provided, otherwise, a random Enterprise Broker associated // with the specified API token or the default Circonus Broker. Defaults to // none. CirconusBrokerID string `hcl:"circonus_broker_id,optional"` // CirconusBrokerSelectTag is a special tag which will be used to select a // broker when a Broker ID is not provided. The best use of this is to as a // hint for which broker should be used based on *where* this particular // instance is running. (e.g. a specific geo location or datacenter, dc:sfo) // Defaults to none. CirconusBrokerSelectTag string `hcl:"circonus_broker_select_tag,optional"` }
Telemetry holds the user specified configuration for metrics collection.