Documentation ¶
Index ¶
Constants ¶
const DefaultAdminAccessLogPath = "/dev/null"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BootstrapConfig ¶
type BootstrapConfig struct { // StatsdURL allows simple configuration of the statsd metrics sink. If // tagging is required, use DogstatsdURL instead. The URL must be in one of // the following forms: // - udp://<ip>:<port> // - $ENV_VAR_NAME in this case the ENV var named will have it's // value taken and is expected to contain a URL in // one of the supported forms above. StatsdURL string `mapstructure:"envoy_statsd_url"` // DogstatsdURL allows simple configuration of the dogstatsd metrics sink // which allows tags and Unix domain sockets. The URL must be in one of the // following forms: // - udp://<ip>:<port> // - unix:///full/path/to/unix.sock // - $ENV_VAR_NAME in this case the ENV var named will have it's // value taken and is expected to contain a URL in // one of the supported forms above. DogstatsdURL string `mapstructure:"envoy_dogstatsd_url"` // StatsTags is a slice of string values that will be added as tags to // metrics. They are used to configure // https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/metrics/v2/stats.proto#envoy-api-msg-config-metrics-v2-statsconfig // and add to the basic tags Consul adds by default like the local_cluster // name. Only exact values are supported here. Full configuration of // stats_config.stats_tags can be made by overriding envoy_stats_config_json. StatsTags []string `mapstructure:"envoy_stats_tags"` // TelemetryCollectorBindSocketDir is a string that configures the directory for a // unix socket where Envoy will forward metrics. These metrics get pushed to // the telemetry collector. TelemetryCollectorBindSocketDir string `mapstructure:"envoy_telemetry_collector_bind_socket_dir"` // PrometheusBindAddr configures an <ip>:<port> on which the Envoy will listen // and expose a single /metrics HTTP endpoint for Prometheus to scrape. It // does this by proxying that URL to the internal admin server's prometheus // endpoint which allows exposing metrics on the network without the security // risk of exposing the full admin server API. Any other URL requested will be // a 404. // // Note that as of Envoy 1.9.0, the built in Prometheus endpoint only exports // counters and gauges but not timing information via histograms. This is // fixed in 1.10-dev currently in Envoy master. Other changes since 1.9.0 make // master incompatible with the current release of Consul Connect. This will // be fixed in a future Consul version as Envoy 1.10 reaches stable release. PrometheusBindAddr string `mapstructure:"envoy_prometheus_bind_addr"` // StatsBindAddr configures an <ip>:<port> on which the Envoy will listen // and expose the /stats HTTP path prefix for any agent to access. It // does this by proxying that path prefix to the internal admin server // which allows exposing metrics on the network without the security // risk of exposing the full admin server API. Any other URL requested will be // a 404. StatsBindAddr string `mapstructure:"envoy_stats_bind_addr"` // ReadyBindAddr configures an <ip>:<port> on which Envoy will listen and // expose a single /ready HTTP endpoint. This is useful for checking the // liveness of an Envoy instance when no other listeners are garaunteed to be // configured, as is the case with ingress gateways. // // Note that we do not allow this to be configured via the service // definition config map currently. ReadyBindAddr string `mapstructure:"-"` // OverrideJSONTpl allows replacing the base template used to render the // bootstrap. This is an "escape hatch" allowing arbitrary control over the // proxy's configuration but will the most effort to maintain and correctly // configure the aspects that Connect relies upon to work. It's recommended // that this only be used if necessary, and that it be based on the default // template in // https://github.com/hashicorp/consul/blob/main/command/connect/envoy/bootstrap_tpl.go // for the correct version of Consul and Envoy being used. OverrideJSONTpl string `mapstructure:"envoy_bootstrap_json_tpl"` // StaticClustersJSON is a JSON string containing zero or more Cluster // definitions. They are appended to the "static_resources.clusters" list. A // single cluster should be given as a plain object, if more than one is to be // added, they should be separated by a comma suitable for direct injection // into a JSON array. // // Note that cluster names should be chosen in such a way that they won't // collide with service names since we use plain service names as cluster // names in xDS to make metrics population simpler and cluster names mush be // unique. // // This is mostly intended for providing clusters for tracing or metrics // services. // // See https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/api/v2/cds.proto. StaticClustersJSON string `mapstructure:"envoy_extra_static_clusters_json"` // StaticListenersJSON is a JSON string containing zero or more Listener // definitions. They are appended to the "static_resources.listeners" list. A // single listener should be given as a plain object, if more than one is to // be added, they should be separated by a comma suitable for direct injection // into a JSON array. // // See https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/api/v2/lds.proto. StaticListenersJSON string `mapstructure:"envoy_extra_static_listeners_json"` // StatsSinksJSON is a JSON string containing zero or more StatsSink // definititions. They are appended to the `stats_sinks` array at the top // level of the bootstrap config. A single sink should be given as a plain // object, if more than one is to be added, they should be separated by a // comma suitable for direct injection into a JSON array. // // See // https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/metrics/v2/stats.proto#config-metrics-v2-statssink. // // If this is non-empty then it will override anything configured in // StatsTags. StatsSinksJSON string `mapstructure:"envoy_extra_stats_sinks_json"` // StatsConfigJSON is a JSON string containing an object in the right format // to be rendered as the body of the `stats_config` field at the top level of // the bootstrap config. It's format may vary based on Envoy version used. See // https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/metrics/v2/stats.proto#envoy-api-msg-config-metrics-v2-statsconfig. // // If this is non-empty then it will override anything configured in // StatsdURL or DogstatsdURL. StatsConfigJSON string `mapstructure:"envoy_stats_config_json"` // StatsFlushInterval is the time duration between Envoy stats flushes. It is // in proto3 "duration" string format for example "1.12s" See // https://developers.google.com/protocol-buffers/docs/proto3#json and // https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/bootstrap/v2/bootstrap.proto#bootstrap StatsFlushInterval string `mapstructure:"envoy_stats_flush_interval"` // TracingConfigJSON is a JSON string containing an object in the right format // to be rendered as the body of the `tracing` field at the top level of // the bootstrap config. It's format may vary based on Envoy version used. // See https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/trace/v2/trace.proto. TracingConfigJSON string `mapstructure:"envoy_tracing_json"` }
BootstrapConfig is the set of keys we care about in a Connect.Proxy.Config map. Note that this only includes config keys that affects Envoy bootstrap generation. For Envoy config keys that affect runtime xDS behavior see agent/xds/config.go.
func (*BootstrapConfig) ConfigureArgs ¶
func (c *BootstrapConfig) ConfigureArgs(args *BootstrapTplArgs, omitDeprecatedTags bool) error
ConfigureArgs takes the basic template arguments generated from the command arguments and environment and modifies them according to the BootstrapConfig.
func (*BootstrapConfig) GenerateJSON ¶
func (c *BootstrapConfig) GenerateJSON(args *BootstrapTplArgs, omitDeprecatedTags bool) ([]byte, error)
func (*BootstrapConfig) Template ¶
func (c *BootstrapConfig) Template() string
Template returns the bootstrap template to use as a base.
type BootstrapTplArgs ¶
type BootstrapTplArgs struct { GRPC // ProxyCluster is the cluster name for the the Envoy `node` specification and // is typically the same as the ProxyID. ProxyCluster string // ProxyID is the ID of the proxy service instance as registered with the // local Consul agent. This must be used as the Envoy `node.id` in order for // the agent to deliver the correct configuration. ProxyID string // NodeName is the name of the node on which the proxy service instance is registered. NodeName string // ProxySourceService is the Consul service name to report for this proxy // instance's source service label. For sidecars it should be the // Proxy.DestinationServiceName. For gateways and similar it is the service // name of the proxy service itself. ProxySourceService string // AgentCAPEM is the CA to use to verify the local agent gRPC service if // TLS is enabled. AgentCAPEM string // AdminAccessLogConfig string representations of Envoy access log // configurations for the admin interface. AdminAccessLogConfig []string // AdminAccessLogPath The path to write the access log for the // administration server. If no access log is desired specify // "/dev/null". By default it will use "/dev/null". Will be overriden by // AdminAccessLogConfig. // DEPRECATED: use AdminAccessLogConfig AdminAccessLogPath string // AdminBindAddress is the address the Envoy admin server should bind to. AdminBindAddress string // AdminBindPort is the port the Envoy admin server should bind to. AdminBindPort string // LocalAgentClusterName is the name reserved for the local Consul agent gRPC // service and is expected to be used for that purpose. LocalAgentClusterName string // Token is the Consul ACL token provided which is required to make gRPC // discovery requests. If non-empty, this must be configured as the gRPC // service "initial_metadata" with the key "x-consul-token" in order to // authorize the discovery streaming RPCs. Token string // StaticClustersJSON is JSON string, each is expected to be a valid Cluster // definition. They are appended to the "static_resources.clusters" list. Note // that cluster names should be chosen in such a way that they won't collide // with service names since we use plain service names as cluster names in xDS // to make metrics population simpler and cluster names mush be unique. See // https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/api/v2/cds.proto. StaticClustersJSON string // StaticListenersJSON is a JSON string containing zero or more Listener // definitions. They are appended to the "static_resources.listeners" list. A // single listener should be given as a plain object, if more than one is to // be added, they should be separated by a comma suitable for direct injection // into a JSON array. // See https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/api/v2/lds.proto. StaticListenersJSON string // StatsSinksJSON is a JSON string containing an array in the right format // to be rendered as the body of the `stats_sinks` field at the top level of // the bootstrap config. It's format may vary based on Envoy version used. See // https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/metrics/v2/stats.proto#config-metrics-v2-statssink. StatsSinksJSON string // StatsConfigJSON is a JSON string containing an object in the right format // to be rendered as the body of the `stats_config` field at the top level of // the bootstrap config. It's format may vary based on Envoy version used. See // https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/metrics/v2/stats.proto#envoy-api-msg-config-metrics-v2-statsconfig. StatsConfigJSON string // StaticSecretsJSON is a JSON string containing zero or more Secret definitions. // See https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/transport_sockets/tls/v3/secret.proto#envoy-v3-api-msg-extensions-transport-sockets-tls-v3-secret StaticSecretsJSON string // StatsFlushInterval is the time duration between Envoy stats flushes. It is // in proto3 "duration" string format for example "1.12s" See // https://developers.google.com/protocol-buffers/docs/proto3#json and // https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/bootstrap/v2/bootstrap.proto#bootstrap StatsFlushInterval string // TracingConfigJSON is a JSON string containing an object in the right format // to be rendered as the body of the `tracing` field at the top level of // the bootstrap config. It's format may vary based on Envoy version used. // See https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/trace/v2/trace.proto. TracingConfigJSON string // Namespace is the Consul Enterprise Namespace of the proxy service instance // as registered with the Consul agent. Namespace string // Partition is the Consul Enterprise Partition of the proxy service instance // as registered with the Consul agent. Partition string // Datacenter is the datacenter where the proxy service instance is registered. Datacenter string // PrometheusBackendPort will configure a "prometheus_backend" cluster which // envoy_prometheus_bind_addr will point to. PrometheusBackendPort string // PrometheusScrapePath will configure the path where metrics are exposed on // the envoy_prometheus_bind_addr listener. PrometheusScrapePath string // PrometheusCAFile is the path to a CA file for Envoy to use when serving TLS on the Prometheius metrics // endpoint. Only applicable when envoy_prometheus_bind_addr is set in the proxy config. PrometheusCAFile string // PrometheusCAPath is the path to a directory of CA certificates for Envoy to use when serving the Prometheus // metrics endpoint. Only applicable when envoy_prometheus_bind_addr is set in the proxy config. PrometheusCAPath string // PrometheusCertFile is the path to a certificate file for Envoy to use when serving TLS on the Prometheus // metrics endpoint. Only applicable when envoy_prometheus_bind_addr is set in the proxy config. PrometheusCertFile string // PrometheusKeyFile is the path to a private key file Envoy to use when serving TLS on the Prometheus metrics // endpoint. Only applicable when envoy_prometheus_bind_addr is set in the proxy config. PrometheusKeyFile string }
BootstrapTplArgs is the set of arguments that may be interpolated into the Envoy bootstrap template.
type GRPC ¶
type GRPC struct { // AgentAddress is the IP address of the local agent where the proxy instance // is registered. AgentAddress string // AgentPort is the gRPC port exposed on the local agent. AgentPort string // AgentTLS is true if the local agent gRPC service should be accessed over // TLS. AgentTLS bool // AgentSocket is the path to a Unix Socket for communicating with the // local agent's gRPC endpoint. Disabled if the empty (the default), // but overrides AgentAddress and AgentPort if set. AgentSocket string }
GRPC settings used in the bootstrap template.
type ServiceAddressMapValue ¶
type ServiceAddressMapValue struct {
// contains filtered or unexported fields
}
func (*ServiceAddressMapValue) Set ¶
func (s *ServiceAddressMapValue) Set(raw string) error
func (*ServiceAddressMapValue) String ¶
func (s *ServiceAddressMapValue) String() string
type ServiceAddressValue ¶
type ServiceAddressValue struct {
// contains filtered or unexported fields
}
ServiceAddressValue implements a flag.Value that may be used to parse an addr:port string into an api.ServiceAddress.
func (*ServiceAddressValue) Set ¶
func (s *ServiceAddressValue) Set(raw string) error
func (*ServiceAddressValue) String ¶
func (s *ServiceAddressValue) String() string
func (*ServiceAddressValue) Value ¶
func (s *ServiceAddressValue) Value() api.ServiceAddress