sources

package
v3.11.0-beta2+incompat... Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package sources contains all of the config source logic. This includes logic to get config content from various sources such as the filesystem or a KV store. It also contains the logic for filling in dynamic values in config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadConfig

func ReadConfig(configPath string, stop <-chan struct{}) ([]byte, <-chan []byte, error)

ReadConfig reads in the main agent config file and optionally watches for changes on it. It will be returned immediately, along with a channel that will be sent any updated config content if watching is enabled.

Types

type DynamicValueProvider

type DynamicValueProvider struct {
	// contains filtered or unexported fields
}

DynamicValueProvider handles setting up and providing dynamic values from remote config sources.

func (*DynamicValueProvider) ReadDynamicValues

func (dvp *DynamicValueProvider) ReadDynamicValues(configContent []byte, stop <-chan struct{}) ([]byte, <-chan []byte, error)

ReadDynamicValues takes the config file content and processes it for any dynamic values of the form `{"#from": ...`. It returns a YAML document that contains the rendered values. It will optionally watch the sources of any dynamic values configured and send updated YAML docs on the returned channel.

type RawDynamicValueSpec

type RawDynamicValueSpec interface{}

RawDynamicValueSpec is a string that should deserialize to a dynamic value path (e.g. {"#from": "/path/to/value"}).

type SourceConfig

type SourceConfig struct {
	// Whether to watch config sources for changes.  If this is `true` and any
	// of the config changes (either the main agent.yaml, or remote config
	// values), the agent will dynamically reconfigure itself with minimal
	// disruption.  This is generally better than restarting the agent on
	// config changes since that can result in larger gaps in metric data.  The
	// main disadvantage of watching is slightly greater network and compute
	// resource usage. This option itself ironically enough is not subject to
	// watching and changing it to false after the agent was started with it
	// true will require an agent restart.
	Watch bool `yaml:"watch" default:"true"`
	// Configuration for other file sources
	File file.Config `yaml:"file" default:"{}"`
	// Configuration for a Zookeeper remote config source
	Zookeeper *zookeeper.Config `yaml:"zookeeper"`
	// Configuration for an Etcd 2 remote config source
	Etcd2 *etcd2.Config `yaml:"etcd2"`
	// Configuration for a Consul remote config source
	Consul *consul.Config `yaml:"consul"`
	// Configuration for a Hashicorp Vault remote config source
	Vault *vault.Config `yaml:"vault"`
}

SourceConfig represents configuration for various config sources that we support.

func (*SourceConfig) Hash

func (sc *SourceConfig) Hash() uint64

Hash calculates a unique hash value for this config struct

func (*SourceConfig) SourceInstances

func (sc *SourceConfig) SourceInstances() (map[string]types.ConfigSource, error)

SourceInstances returns a map of instantiated sources based on the config

Directories

Path Synopsis
Package vault contains the logic for using Vault as a remote config source How to use auth methods with Vault Go client: https://groups.google.com/forum/#!msg/vault-tool/cS7J2KbAwZg/7pu6PYSRAAAJ
Package vault contains the logic for using Vault as a remote config source How to use auth methods with Vault Go client: https://groups.google.com/forum/#!msg/vault-tool/cS7J2KbAwZg/7pu6PYSRAAAJ
Package zookeeper contains the logic for using Zookeeper as a config source.
Package zookeeper contains the logic for using Zookeeper as a config source.

Jump to

Keyboard shortcuts

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