Rename hcp-metrics-collector to consul-telemetry-collector (#17327)
* Rename hcp-metrics-collector to consul-telemetry-collector * Fix docs * Fix doc comment --------- Co-authored-by: Ashvitha Sridharan <ashvitha.sridharan@hashicorp.com>
This commit is contained in:
parent
a20102560e
commit
6532ede487
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
xds: rename envoy_hcp_metrics_bind_socket_dir to envoy_telemetry_collector_bind_socket_dir to remove HCP naming references.
|
||||||
|
```
|
|
@ -112,8 +112,8 @@ func (s *handlerConnectProxy) initialize(ctx context.Context) (ConfigSnapshot, e
|
||||||
return snap, err
|
return snap, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.maybeInitializeHCPMetricsWatches(ctx, snap); err != nil {
|
if err := s.maybeInitializeTelemetryCollectorWatches(ctx, snap); err != nil {
|
||||||
return snap, fmt.Errorf("failed to initialize HCP metrics watches: %w", err)
|
return snap, fmt.Errorf("failed to initialize telemetry collector watches: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.proxyCfg.Mode == structs.ProxyModeTransparent {
|
if s.proxyCfg.Mode == structs.ProxyModeTransparent {
|
||||||
|
@ -628,16 +628,17 @@ func (s *handlerConnectProxy) handleUpdate(ctx context.Context, u UpdateEvent, s
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// hcpMetricsConfig represents the basic opaque config values for pushing telemetry to HCP.
|
// telemetryCollectorConfig represents the basic opaque config values for pushing telemetry to
|
||||||
type hcpMetricsConfig struct {
|
// a consul telemetry collector.
|
||||||
// HCPMetricsBindSocketDir is a string that configures the directory for a
|
type telemetryCollectorConfig struct {
|
||||||
|
// TelemetryCollectorBindSocketDir is a string that configures the directory for a
|
||||||
// unix socket where Envoy will forward metrics. These metrics get pushed to
|
// unix socket where Envoy will forward metrics. These metrics get pushed to
|
||||||
// the HCP Metrics collector to show service mesh metrics on HCP.
|
// the Consul Telemetry collector.
|
||||||
HCPMetricsBindSocketDir string `mapstructure:"envoy_hcp_metrics_bind_socket_dir"`
|
TelemetryCollectorBindSocketDir string `mapstructure:"envoy_telemetry_collector_bind_socket_dir"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseHCPMetricsConfig(m map[string]interface{}) (hcpMetricsConfig, error) {
|
func parseTelemetryCollectorConfig(m map[string]interface{}) (telemetryCollectorConfig, error) {
|
||||||
var cfg hcpMetricsConfig
|
var cfg telemetryCollectorConfig
|
||||||
err := mapstructure.WeakDecode(m, &cfg)
|
err := mapstructure.WeakDecode(m, &cfg)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -647,21 +648,21 @@ func parseHCPMetricsConfig(m map[string]interface{}) (hcpMetricsConfig, error) {
|
||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybeInitializeHCPMetricsWatches will initialize a synthetic upstream and discovery chain
|
// maybeInitializeTelemetryCollectorWatches will initialize a synthetic upstream and discovery chain
|
||||||
// watch for the HCP metrics collector, if metrics collection is enabled on the proxy registration.
|
// watch for the consul telemetry collector, if telemetry data collection is enabled on the proxy registration.
|
||||||
func (s *handlerConnectProxy) maybeInitializeHCPMetricsWatches(ctx context.Context, snap ConfigSnapshot) error {
|
func (s *handlerConnectProxy) maybeInitializeTelemetryCollectorWatches(ctx context.Context, snap ConfigSnapshot) error {
|
||||||
hcpCfg, err := parseHCPMetricsConfig(s.proxyCfg.Config)
|
cfg, err := parseTelemetryCollectorConfig(s.proxyCfg.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Error("failed to parse connect.proxy.config", "error", err)
|
s.logger.Error("failed to parse connect.proxy.config", "error", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if hcpCfg.HCPMetricsBindSocketDir == "" {
|
if cfg.TelemetryCollectorBindSocketDir == "" {
|
||||||
// Metrics collection is not enabled, return early.
|
// telemetry collection is not enabled, return early.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// The path includes the proxy ID so that when multiple proxies are on the same host
|
// The path includes the proxy ID so that when multiple proxies are on the same host
|
||||||
// they each have a distinct path to send their metrics.
|
// they each have a distinct path to send their telemetry data.
|
||||||
id := s.proxyID.NamespaceOrDefault() + "_" + s.proxyID.ID
|
id := s.proxyID.NamespaceOrDefault() + "_" + s.proxyID.ID
|
||||||
|
|
||||||
// UNIX domain sockets paths have a max length of 108, so we take a hash of the compound ID
|
// UNIX domain sockets paths have a max length of 108, so we take a hash of the compound ID
|
||||||
|
@ -669,12 +670,12 @@ func (s *handlerConnectProxy) maybeInitializeHCPMetricsWatches(ctx context.Conte
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
h.Write([]byte(id))
|
h.Write([]byte(id))
|
||||||
hash := base64.RawURLEncoding.EncodeToString(h.Sum(nil))
|
hash := base64.RawURLEncoding.EncodeToString(h.Sum(nil))
|
||||||
path := path.Join(hcpCfg.HCPMetricsBindSocketDir, hash+".sock")
|
path := path.Join(cfg.TelemetryCollectorBindSocketDir, hash+".sock")
|
||||||
|
|
||||||
upstream := structs.Upstream{
|
upstream := structs.Upstream{
|
||||||
DestinationNamespace: acl.DefaultNamespaceName,
|
DestinationNamespace: acl.DefaultNamespaceName,
|
||||||
DestinationPartition: s.proxyID.PartitionOrDefault(),
|
DestinationPartition: s.proxyID.PartitionOrDefault(),
|
||||||
DestinationName: api.HCPMetricsCollectorName,
|
DestinationName: api.TelemetryCollectorName,
|
||||||
LocalBindSocketPath: path,
|
LocalBindSocketPath: path,
|
||||||
Config: map[string]interface{}{
|
Config: map[string]interface{}{
|
||||||
"protocol": "grpc",
|
"protocol": "grpc",
|
||||||
|
|
|
@ -467,18 +467,18 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
|
|
||||||
// Used to account for differences in OSS/ent implementations of ServiceID.String()
|
// Used to account for differences in OSS/ent implementations of ServiceID.String()
|
||||||
var (
|
var (
|
||||||
db = structs.NewServiceName("db", nil)
|
db = structs.NewServiceName("db", nil)
|
||||||
billing = structs.NewServiceName("billing", nil)
|
billing = structs.NewServiceName("billing", nil)
|
||||||
api = structs.NewServiceName("api", nil)
|
api = structs.NewServiceName("api", nil)
|
||||||
apiA = structs.NewServiceName("api-a", nil)
|
apiA = structs.NewServiceName("api-a", nil)
|
||||||
hcpCollector = structs.NewServiceName(apimod.HCPMetricsCollectorName, nil)
|
telemetryCollector = structs.NewServiceName(apimod.TelemetryCollectorName, nil)
|
||||||
|
|
||||||
apiUID = NewUpstreamIDFromServiceName(api)
|
apiUID = NewUpstreamIDFromServiceName(api)
|
||||||
dbUID = NewUpstreamIDFromServiceName(db)
|
dbUID = NewUpstreamIDFromServiceName(db)
|
||||||
pqUID = UpstreamIDFromString("prepared_query:query")
|
pqUID = UpstreamIDFromString("prepared_query:query")
|
||||||
extApiUID = NewUpstreamIDFromServiceName(apiA)
|
extApiUID = NewUpstreamIDFromServiceName(apiA)
|
||||||
extDBUID = NewUpstreamIDFromServiceName(db)
|
extDBUID = NewUpstreamIDFromServiceName(db)
|
||||||
hcpCollectorUID = NewUpstreamIDFromServiceName(hcpCollector)
|
telemetryCollectorUID = NewUpstreamIDFromServiceName(telemetryCollector)
|
||||||
)
|
)
|
||||||
// TODO(peering): NewUpstreamIDFromServiceName should take a PeerName
|
// TODO(peering): NewUpstreamIDFromServiceName should take a PeerName
|
||||||
extApiUID.Peer = "peer-a"
|
extApiUID.Peer = "peer-a"
|
||||||
|
@ -3638,7 +3638,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"hcp-metrics": {
|
"telemetry-collector": {
|
||||||
ns: structs.NodeService{
|
ns: structs.NodeService{
|
||||||
Kind: structs.ServiceKindConnectProxy,
|
Kind: structs.ServiceKindConnectProxy,
|
||||||
ID: "web-sidecar-proxy",
|
ID: "web-sidecar-proxy",
|
||||||
|
@ -3648,7 +3648,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
Proxy: structs.ConnectProxyConfig{
|
Proxy: structs.ConnectProxyConfig{
|
||||||
DestinationServiceName: "web",
|
DestinationServiceName: "web",
|
||||||
Config: map[string]interface{}{
|
Config: map[string]interface{}{
|
||||||
"envoy_hcp_metrics_bind_socket_dir": "/tmp/consul/hcp-metrics/",
|
"envoy_telemetry_collector_bind_socket_dir": "/tmp/consul/telemetry-collector/",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -3656,8 +3656,8 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
stages: []verificationStage{
|
stages: []verificationStage{
|
||||||
{
|
{
|
||||||
requiredWatches: map[string]verifyWatchRequest{
|
requiredWatches: map[string]verifyWatchRequest{
|
||||||
fmt.Sprintf("discovery-chain:%s", hcpCollectorUID.String()): genVerifyDiscoveryChainWatch(&structs.DiscoveryChainRequest{
|
fmt.Sprintf("discovery-chain:%s", telemetryCollectorUID.String()): genVerifyDiscoveryChainWatch(&structs.DiscoveryChainRequest{
|
||||||
Name: hcpCollector.Name,
|
Name: telemetryCollector.Name,
|
||||||
EvaluateInDatacenter: "dc1",
|
EvaluateInDatacenter: "dc1",
|
||||||
EvaluateInNamespace: "default",
|
EvaluateInNamespace: "default",
|
||||||
EvaluateInPartition: "default",
|
EvaluateInPartition: "default",
|
||||||
|
@ -3698,9 +3698,9 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
Result: &structs.ConfigEntryResponse{},
|
Result: &structs.ConfigEntryResponse{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
CorrelationID: fmt.Sprintf("discovery-chain:%s", hcpCollectorUID.String()),
|
CorrelationID: fmt.Sprintf("discovery-chain:%s", telemetryCollectorUID.String()),
|
||||||
Result: &structs.DiscoveryChainResponse{
|
Result: &structs.DiscoveryChainResponse{
|
||||||
Chain: discoverychain.TestCompileConfigEntries(t, hcpCollector.Name, "default", "default", "dc1", "trustdomain.consul", nil, nil),
|
Chain: discoverychain.TestCompileConfigEntries(t, telemetryCollector.Name, "default", "default", "dc1", "trustdomain.consul", nil, nil),
|
||||||
},
|
},
|
||||||
Err: nil,
|
Err: nil,
|
||||||
},
|
},
|
||||||
|
@ -3710,19 +3710,19 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
require.Equal(t, indexedRoots, snap.Roots)
|
require.Equal(t, indexedRoots, snap.Roots)
|
||||||
require.Equal(t, issuedCert, snap.ConnectProxy.Leaf)
|
require.Equal(t, issuedCert, snap.ConnectProxy.Leaf)
|
||||||
|
|
||||||
// An event was received with the HCP collector's discovery chain, which sets up some bookkeeping in the snapshot.
|
// An event was received with the telemetry collector's discovery chain, which sets up some bookkeeping in the snapshot.
|
||||||
require.Len(t, snap.ConnectProxy.DiscoveryChain, 1, "%+v", snap.ConnectProxy.DiscoveryChain)
|
require.Len(t, snap.ConnectProxy.DiscoveryChain, 1, "%+v", snap.ConnectProxy.DiscoveryChain)
|
||||||
require.Contains(t, snap.ConnectProxy.DiscoveryChain, hcpCollectorUID)
|
require.Contains(t, snap.ConnectProxy.DiscoveryChain, telemetryCollectorUID)
|
||||||
|
|
||||||
require.Len(t, snap.ConnectProxy.WatchedUpstreams, 1, "%+v", snap.ConnectProxy.WatchedUpstreams)
|
require.Len(t, snap.ConnectProxy.WatchedUpstreams, 1, "%+v", snap.ConnectProxy.WatchedUpstreams)
|
||||||
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints, 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints)
|
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints, 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints)
|
||||||
require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints, hcpCollectorUID)
|
require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints, telemetryCollectorUID)
|
||||||
|
|
||||||
expectUpstream := structs.Upstream{
|
expectUpstream := structs.Upstream{
|
||||||
DestinationNamespace: "default",
|
DestinationNamespace: "default",
|
||||||
DestinationPartition: "default",
|
DestinationPartition: "default",
|
||||||
DestinationName: apimod.HCPMetricsCollectorName,
|
DestinationName: apimod.TelemetryCollectorName,
|
||||||
LocalBindSocketPath: "/tmp/consul/hcp-metrics/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock",
|
LocalBindSocketPath: "/tmp/consul/telemetry-collector/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock",
|
||||||
Config: map[string]interface{}{
|
Config: map[string]interface{}{
|
||||||
"protocol": "grpc",
|
"protocol": "grpc",
|
||||||
},
|
},
|
||||||
|
@ -3733,16 +3733,16 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
require.Equal(t, &expectUpstream, snap.ConnectProxy.UpstreamConfig[uid])
|
require.Equal(t, &expectUpstream, snap.ConnectProxy.UpstreamConfig[uid])
|
||||||
|
|
||||||
// No endpoints have arrived yet.
|
// No endpoints have arrived yet.
|
||||||
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints[hcpCollectorUID], 0, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints)
|
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints[telemetryCollectorUID], 0, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
requiredWatches: map[string]verifyWatchRequest{
|
requiredWatches: map[string]verifyWatchRequest{
|
||||||
fmt.Sprintf("upstream-target:%s.default.default.dc1:", apimod.HCPMetricsCollectorName) + hcpCollectorUID.String(): genVerifyServiceSpecificRequest(apimod.HCPMetricsCollectorName, "", "dc1", true),
|
fmt.Sprintf("upstream-target:%s.default.default.dc1:", apimod.TelemetryCollectorName) + telemetryCollectorUID.String(): genVerifyServiceSpecificRequest(apimod.TelemetryCollectorName, "", "dc1", true),
|
||||||
},
|
},
|
||||||
events: []UpdateEvent{
|
events: []UpdateEvent{
|
||||||
{
|
{
|
||||||
CorrelationID: fmt.Sprintf("upstream-target:%s.default.default.dc1:", apimod.HCPMetricsCollectorName) + hcpCollectorUID.String(),
|
CorrelationID: fmt.Sprintf("upstream-target:%s.default.default.dc1:", apimod.TelemetryCollectorName) + telemetryCollectorUID.String(),
|
||||||
Result: &structs.IndexedCheckServiceNodes{
|
Result: &structs.IndexedCheckServiceNodes{
|
||||||
Nodes: structs.CheckServiceNodes{
|
Nodes: structs.CheckServiceNodes{
|
||||||
{
|
{
|
||||||
|
@ -3751,8 +3751,8 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
Address: "10.0.0.1",
|
Address: "10.0.0.1",
|
||||||
},
|
},
|
||||||
Service: &structs.NodeService{
|
Service: &structs.NodeService{
|
||||||
ID: apimod.HCPMetricsCollectorName,
|
ID: apimod.TelemetryCollectorName,
|
||||||
Service: apimod.HCPMetricsCollectorName,
|
Service: apimod.TelemetryCollectorName,
|
||||||
Port: 8080,
|
Port: 8080,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -3766,16 +3766,16 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
require.Equal(t, indexedRoots, snap.Roots)
|
require.Equal(t, indexedRoots, snap.Roots)
|
||||||
require.Equal(t, issuedCert, snap.ConnectProxy.Leaf)
|
require.Equal(t, issuedCert, snap.ConnectProxy.Leaf)
|
||||||
|
|
||||||
// Discovery chain for the HCP collector should still be stored in the snapshot.
|
// Discovery chain for the telemetry collector should still be stored in the snapshot.
|
||||||
require.Len(t, snap.ConnectProxy.DiscoveryChain, 1, "%+v", snap.ConnectProxy.DiscoveryChain)
|
require.Len(t, snap.ConnectProxy.DiscoveryChain, 1, "%+v", snap.ConnectProxy.DiscoveryChain)
|
||||||
require.Contains(t, snap.ConnectProxy.DiscoveryChain, hcpCollectorUID)
|
require.Contains(t, snap.ConnectProxy.DiscoveryChain, telemetryCollectorUID)
|
||||||
|
|
||||||
require.Len(t, snap.ConnectProxy.WatchedUpstreams, 1, "%+v", snap.ConnectProxy.WatchedUpstreams)
|
require.Len(t, snap.ConnectProxy.WatchedUpstreams, 1, "%+v", snap.ConnectProxy.WatchedUpstreams)
|
||||||
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints, 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints)
|
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints, 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints)
|
||||||
require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints, hcpCollectorUID)
|
require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints, telemetryCollectorUID)
|
||||||
|
|
||||||
// An endpoint arrived for the HCP collector, so it should be present in the snapshot.
|
// An endpoint arrived for the telemetry collector, so it should be present in the snapshot.
|
||||||
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints[hcpCollectorUID], 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints)
|
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints[telemetryCollectorUID], 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints)
|
||||||
|
|
||||||
nodes := structs.CheckServiceNodes{
|
nodes := structs.CheckServiceNodes{
|
||||||
{
|
{
|
||||||
|
@ -3784,14 +3784,14 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
||||||
Address: "10.0.0.1",
|
Address: "10.0.0.1",
|
||||||
},
|
},
|
||||||
Service: &structs.NodeService{
|
Service: &structs.NodeService{
|
||||||
ID: apimod.HCPMetricsCollectorName,
|
ID: apimod.TelemetryCollectorName,
|
||||||
Service: apimod.HCPMetricsCollectorName,
|
Service: apimod.TelemetryCollectorName,
|
||||||
Port: 8080,
|
Port: 8080,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
target := fmt.Sprintf("%s.default.default.dc1", apimod.HCPMetricsCollectorName)
|
target := fmt.Sprintf("%s.default.default.dc1", apimod.TelemetryCollectorName)
|
||||||
require.Equal(t, nodes, snap.ConnectProxy.WatchedUpstreamEndpoints[hcpCollectorUID][target])
|
require.Equal(t, nodes, snap.ConnectProxy.WatchedUpstreamEndpoints[telemetryCollectorUID][target])
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -302,19 +302,19 @@ func TestConfigSnapshotGRPCExposeHTTP1(t testing.T) *ConfigSnapshot {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestConfigSnapshotDiscoveryChain returns a fully populated snapshot using a discovery chain
|
// TestConfigSnapshotTelemetryCollector returns a fully populated snapshot using a discovery chain
|
||||||
func TestConfigSnapshotHCPMetrics(t testing.T) *ConfigSnapshot {
|
func TestConfigSnapshotTelemetryCollector(t testing.T) *ConfigSnapshot {
|
||||||
// DiscoveryChain without an UpstreamConfig should yield a
|
// DiscoveryChain without an UpstreamConfig should yield a
|
||||||
// filter chain when in transparent proxy mode
|
// filter chain when in transparent proxy mode
|
||||||
var (
|
var (
|
||||||
collector = structs.NewServiceName(api.HCPMetricsCollectorName, nil)
|
collector = structs.NewServiceName(api.TelemetryCollectorName, nil)
|
||||||
collectorUID = NewUpstreamIDFromServiceName(collector)
|
collectorUID = NewUpstreamIDFromServiceName(collector)
|
||||||
collectorChain = discoverychain.TestCompileConfigEntries(t, api.HCPMetricsCollectorName, "default", "default", "dc1", connect.TestClusterID+".consul", nil, nil)
|
collectorChain = discoverychain.TestCompileConfigEntries(t, api.TelemetryCollectorName, "default", "default", "dc1", connect.TestClusterID+".consul", nil, nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
return TestConfigSnapshot(t, func(ns *structs.NodeService) {
|
return TestConfigSnapshot(t, func(ns *structs.NodeService) {
|
||||||
ns.Proxy.Config = map[string]interface{}{
|
ns.Proxy.Config = map[string]interface{}{
|
||||||
"envoy_hcp_metrics_bind_socket_dir": "/tmp/consul/hcp-metrics",
|
"envoy_telemetry_collector_bind_socket_dir": "/tmp/consul/telemetry-collector",
|
||||||
}
|
}
|
||||||
}, []UpdateEvent{
|
}, []UpdateEvent{
|
||||||
{
|
{
|
||||||
|
@ -330,7 +330,7 @@ func TestConfigSnapshotHCPMetrics(t testing.T) *ConfigSnapshot {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
CorrelationID: fmt.Sprintf("upstream-target:%s.default.default.dc1:", api.HCPMetricsCollectorName) + collectorUID.String(),
|
CorrelationID: fmt.Sprintf("upstream-target:%s.default.default.dc1:", api.TelemetryCollectorName) + collectorUID.String(),
|
||||||
Result: &structs.IndexedCheckServiceNodes{
|
Result: &structs.IndexedCheckServiceNodes{
|
||||||
Nodes: []structs.CheckServiceNode{
|
Nodes: []structs.CheckServiceNode{
|
||||||
{
|
{
|
||||||
|
@ -339,7 +339,7 @@ func TestConfigSnapshotHCPMetrics(t testing.T) *ConfigSnapshot {
|
||||||
Datacenter: "dc1",
|
Datacenter: "dc1",
|
||||||
},
|
},
|
||||||
Service: &structs.NodeService{
|
Service: &structs.NodeService{
|
||||||
Service: api.HCPMetricsCollectorName,
|
Service: api.TelemetryCollectorName,
|
||||||
Address: "9.9.9.9",
|
Address: "9.9.9.9",
|
||||||
Port: 9090,
|
Port: 9090,
|
||||||
},
|
},
|
||||||
|
|
|
@ -172,8 +172,8 @@ func TestAllResourcesFromSnapshot(t *testing.T) {
|
||||||
create: proxycfg.TestConfigSnapshotPeeringLocalMeshGateway,
|
create: proxycfg.TestConfigSnapshotPeeringLocalMeshGateway,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "hcp-metrics",
|
name: "telemetry-collector",
|
||||||
create: proxycfg.TestConfigSnapshotHCPMetrics,
|
create: proxycfg.TestConfigSnapshotTelemetryCollector,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tests = append(tests, getConnectProxyTransparentProxyGoldenTestCases()...)
|
tests = append(tests, getConnectProxyTransparentProxyGoldenTestCases()...)
|
||||||
|
|
|
@ -1,6 +1,62 @@
|
||||||
{
|
{
|
||||||
"versionInfo": "00000001",
|
"versionInfo": "00000001",
|
||||||
"resources": [
|
"resources": [
|
||||||
|
{
|
||||||
|
"@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
|
||||||
|
"name": "consul-telemetry-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
||||||
|
"altStatName": "consul-telemetry-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
||||||
|
"type": "EDS",
|
||||||
|
"edsClusterConfig": {
|
||||||
|
"edsConfig": {
|
||||||
|
"ads": {},
|
||||||
|
"resourceApiVersion": "V3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"connectTimeout": "5s",
|
||||||
|
"circuitBreakers": {},
|
||||||
|
"typedExtensionProtocolOptions": {
|
||||||
|
"envoy.extensions.upstreams.http.v3.HttpProtocolOptions": {
|
||||||
|
"@type": "type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions",
|
||||||
|
"explicitHttpConfig": {
|
||||||
|
"http2ProtocolOptions": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outlierDetection": {},
|
||||||
|
"commonLbConfig": {
|
||||||
|
"healthyPanicThreshold": {}
|
||||||
|
},
|
||||||
|
"transportSocket": {
|
||||||
|
"name": "tls",
|
||||||
|
"typedConfig": {
|
||||||
|
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext",
|
||||||
|
"commonTlsContext": {
|
||||||
|
"tlsParams": {},
|
||||||
|
"tlsCertificates": [
|
||||||
|
{
|
||||||
|
"certificateChain": {
|
||||||
|
"inlineString": "-----BEGIN CERTIFICATE-----\nMIICjDCCAjKgAwIBAgIIC5llxGV1gB8wCgYIKoZIzj0EAwIwFDESMBAGA1UEAxMJ\nVGVzdCBDQSAyMB4XDTE5MDMyMjEzNTgyNloXDTI5MDMyMjEzNTgyNlowDjEMMAoG\nA1UEAxMDd2ViMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEADPv1RHVNRfa2VKR\nAB16b6rZnEt7tuhaxCFpQXPj7M2omb0B9Favq5E0ivpNtv1QnFhxtPd7d5k4e+T7\nSkW1TaOCAXIwggFuMA4GA1UdDwEB/wQEAwIDuDAdBgNVHSUEFjAUBggrBgEFBQcD\nAgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADBoBgNVHQ4EYQRfN2Q6MDc6ODc6M2E6\nNDA6MTk6NDc6YzM6NWE6YzA6YmE6NjI6ZGY6YWY6NGI6ZDQ6MDU6MjU6NzY6M2Q6\nNWE6OGQ6MTY6OGQ6Njc6NWU6MmU6YTA6MzQ6N2Q6ZGM6ZmYwagYDVR0jBGMwYYBf\nZDE6MTE6MTE6YWM6MmE6YmE6OTc6YjI6M2Y6YWM6N2I6YmQ6ZGE6YmU6YjE6OGE6\nZmM6OWE6YmE6YjU6YmM6ODM6ZTc6NWU6NDE6NmY6ZjI6NzM6OTU6NTg6MGM6ZGIw\nWQYDVR0RBFIwUIZOc3BpZmZlOi8vMTExMTExMTEtMjIyMi0zMzMzLTQ0NDQtNTU1\nNTU1NTU1NTU1LmNvbnN1bC9ucy9kZWZhdWx0L2RjL2RjMS9zdmMvd2ViMAoGCCqG\nSM49BAMCA0gAMEUCIGC3TTvvjj76KMrguVyFf4tjOqaSCRie3nmHMRNNRav7AiEA\npY0heYeK9A6iOLrzqxSerkXXQyj5e9bE4VgUnxgPU6g=\n-----END CERTIFICATE-----\n"
|
||||||
|
},
|
||||||
|
"privateKey": {
|
||||||
|
"inlineString": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIMoTkpRggp3fqZzFKh82yS4LjtJI+XY+qX/7DefHFrtdoAoGCCqGSM49\nAwEHoUQDQgAEADPv1RHVNRfa2VKRAB16b6rZnEt7tuhaxCFpQXPj7M2omb0B9Fav\nq5E0ivpNtv1QnFhxtPd7d5k4e+T7SkW1TQ==\n-----END EC PRIVATE KEY-----\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"validationContext": {
|
||||||
|
"trustedCa": {
|
||||||
|
"inlineString": "-----BEGIN CERTIFICATE-----\nMIICXDCCAgKgAwIBAgIICpZq70Z9LyUwCgYIKoZIzj0EAwIwFDESMBAGA1UEAxMJ\nVGVzdCBDQSAyMB4XDTE5MDMyMjEzNTgyNloXDTI5MDMyMjEzNTgyNlowFDESMBAG\nA1UEAxMJVGVzdCBDQSAyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEIhywH1gx\nAsMwuF3ukAI5YL2jFxH6Usnma1HFSfVyxbXX1/uoZEYrj8yCAtdU2yoHETyd+Zx2\nThhRLP79pYegCaOCATwwggE4MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTAD\nAQH/MGgGA1UdDgRhBF9kMToxMToxMTphYzoyYTpiYTo5NzpiMjozZjphYzo3Yjpi\nZDpkYTpiZTpiMTo4YTpmYzo5YTpiYTpiNTpiYzo4MzplNzo1ZTo0MTo2ZjpmMjo3\nMzo5NTo1ODowYzpkYjBqBgNVHSMEYzBhgF9kMToxMToxMTphYzoyYTpiYTo5Nzpi\nMjozZjphYzo3YjpiZDpkYTpiZTpiMTo4YTpmYzo5YTpiYTpiNTpiYzo4MzplNzo1\nZTo0MTo2ZjpmMjo3Mzo5NTo1ODowYzpkYjA/BgNVHREEODA2hjRzcGlmZmU6Ly8x\nMTExMTExMS0yMjIyLTMzMzMtNDQ0NC01NTU1NTU1NTU1NTUuY29uc3VsMAoGCCqG\nSM49BAMCA0gAMEUCICOY0i246rQHJt8o8Oya0D5PLL1FnmsQmQqIGCi31RwnAiEA\noR5f6Ku+cig2Il8T8LJujOp2/2A72QcHZA57B13y+8o=\n-----END CERTIFICATE-----\n"
|
||||||
|
},
|
||||||
|
"matchSubjectAltNames": [
|
||||||
|
{
|
||||||
|
"exact": "spiffe://11111111-2222-3333-4444-555555555555.consul/ns/default/dc/dc1/svc/consul-telemetry-collector"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sni": "consul-telemetry-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
|
"@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
|
||||||
"name": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
"name": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
||||||
|
@ -96,62 +152,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
|
|
||||||
"name": "hcp-metrics-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
||||||
"altStatName": "hcp-metrics-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
||||||
"type": "EDS",
|
|
||||||
"edsClusterConfig": {
|
|
||||||
"edsConfig": {
|
|
||||||
"ads": {},
|
|
||||||
"resourceApiVersion": "V3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"connectTimeout": "5s",
|
|
||||||
"circuitBreakers": {},
|
|
||||||
"typedExtensionProtocolOptions": {
|
|
||||||
"envoy.extensions.upstreams.http.v3.HttpProtocolOptions": {
|
|
||||||
"@type": "type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions",
|
|
||||||
"explicitHttpConfig": {
|
|
||||||
"http2ProtocolOptions": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"outlierDetection": {},
|
|
||||||
"commonLbConfig": {
|
|
||||||
"healthyPanicThreshold": {}
|
|
||||||
},
|
|
||||||
"transportSocket": {
|
|
||||||
"name": "tls",
|
|
||||||
"typedConfig": {
|
|
||||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext",
|
|
||||||
"commonTlsContext": {
|
|
||||||
"tlsParams": {},
|
|
||||||
"tlsCertificates": [
|
|
||||||
{
|
|
||||||
"certificateChain": {
|
|
||||||
"inlineString": "-----BEGIN CERTIFICATE-----\nMIICjDCCAjKgAwIBAgIIC5llxGV1gB8wCgYIKoZIzj0EAwIwFDESMBAGA1UEAxMJ\nVGVzdCBDQSAyMB4XDTE5MDMyMjEzNTgyNloXDTI5MDMyMjEzNTgyNlowDjEMMAoG\nA1UEAxMDd2ViMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEADPv1RHVNRfa2VKR\nAB16b6rZnEt7tuhaxCFpQXPj7M2omb0B9Favq5E0ivpNtv1QnFhxtPd7d5k4e+T7\nSkW1TaOCAXIwggFuMA4GA1UdDwEB/wQEAwIDuDAdBgNVHSUEFjAUBggrBgEFBQcD\nAgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADBoBgNVHQ4EYQRfN2Q6MDc6ODc6M2E6\nNDA6MTk6NDc6YzM6NWE6YzA6YmE6NjI6ZGY6YWY6NGI6ZDQ6MDU6MjU6NzY6M2Q6\nNWE6OGQ6MTY6OGQ6Njc6NWU6MmU6YTA6MzQ6N2Q6ZGM6ZmYwagYDVR0jBGMwYYBf\nZDE6MTE6MTE6YWM6MmE6YmE6OTc6YjI6M2Y6YWM6N2I6YmQ6ZGE6YmU6YjE6OGE6\nZmM6OWE6YmE6YjU6YmM6ODM6ZTc6NWU6NDE6NmY6ZjI6NzM6OTU6NTg6MGM6ZGIw\nWQYDVR0RBFIwUIZOc3BpZmZlOi8vMTExMTExMTEtMjIyMi0zMzMzLTQ0NDQtNTU1\nNTU1NTU1NTU1LmNvbnN1bC9ucy9kZWZhdWx0L2RjL2RjMS9zdmMvd2ViMAoGCCqG\nSM49BAMCA0gAMEUCIGC3TTvvjj76KMrguVyFf4tjOqaSCRie3nmHMRNNRav7AiEA\npY0heYeK9A6iOLrzqxSerkXXQyj5e9bE4VgUnxgPU6g=\n-----END CERTIFICATE-----\n"
|
|
||||||
},
|
|
||||||
"privateKey": {
|
|
||||||
"inlineString": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIMoTkpRggp3fqZzFKh82yS4LjtJI+XY+qX/7DefHFrtdoAoGCCqGSM49\nAwEHoUQDQgAEADPv1RHVNRfa2VKRAB16b6rZnEt7tuhaxCFpQXPj7M2omb0B9Fav\nq5E0ivpNtv1QnFhxtPd7d5k4e+T7SkW1TQ==\n-----END EC PRIVATE KEY-----\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validationContext": {
|
|
||||||
"trustedCa": {
|
|
||||||
"inlineString": "-----BEGIN CERTIFICATE-----\nMIICXDCCAgKgAwIBAgIICpZq70Z9LyUwCgYIKoZIzj0EAwIwFDESMBAGA1UEAxMJ\nVGVzdCBDQSAyMB4XDTE5MDMyMjEzNTgyNloXDTI5MDMyMjEzNTgyNlowFDESMBAG\nA1UEAxMJVGVzdCBDQSAyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEIhywH1gx\nAsMwuF3ukAI5YL2jFxH6Usnma1HFSfVyxbXX1/uoZEYrj8yCAtdU2yoHETyd+Zx2\nThhRLP79pYegCaOCATwwggE4MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTAD\nAQH/MGgGA1UdDgRhBF9kMToxMToxMTphYzoyYTpiYTo5NzpiMjozZjphYzo3Yjpi\nZDpkYTpiZTpiMTo4YTpmYzo5YTpiYTpiNTpiYzo4MzplNzo1ZTo0MTo2ZjpmMjo3\nMzo5NTo1ODowYzpkYjBqBgNVHSMEYzBhgF9kMToxMToxMTphYzoyYTpiYTo5Nzpi\nMjozZjphYzo3YjpiZDpkYTpiZTpiMTo4YTpmYzo5YTpiYTpiNTpiYzo4MzplNzo1\nZTo0MTo2ZjpmMjo3Mzo5NTo1ODowYzpkYjA/BgNVHREEODA2hjRzcGlmZmU6Ly8x\nMTExMTExMS0yMjIyLTMzMzMtNDQ0NC01NTU1NTU1NTU1NTUuY29uc3VsMAoGCCqG\nSM49BAMCA0gAMEUCICOY0i246rQHJt8o8Oya0D5PLL1FnmsQmQqIGCi31RwnAiEA\noR5f6Ku+cig2Il8T8LJujOp2/2A72QcHZA57B13y+8o=\n-----END CERTIFICATE-----\n"
|
|
||||||
},
|
|
||||||
"matchSubjectAltNames": [
|
|
||||||
{
|
|
||||||
"exact": "spiffe://11111111-2222-3333-4444-555555555555.consul/ns/default/dc/dc1/svc/hcp-metrics-collector"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sni": "hcp-metrics-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
|
"@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
|
||||||
"name": "local_app",
|
"name": "local_app",
|
|
@ -1,97 +0,0 @@
|
||||||
{
|
|
||||||
"versionInfo": "00000001",
|
|
||||||
"resources": [
|
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
|
|
||||||
"clusterName": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
||||||
"endpoints": [
|
|
||||||
{
|
|
||||||
"lbEndpoints": [
|
|
||||||
{
|
|
||||||
"endpoint": {
|
|
||||||
"address": {
|
|
||||||
"socketAddress": {
|
|
||||||
"address": "10.10.1.1",
|
|
||||||
"portValue": 8080
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"healthStatus": "HEALTHY",
|
|
||||||
"loadBalancingWeight": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"endpoint": {
|
|
||||||
"address": {
|
|
||||||
"socketAddress": {
|
|
||||||
"address": "10.10.1.2",
|
|
||||||
"portValue": 8080
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"healthStatus": "HEALTHY",
|
|
||||||
"loadBalancingWeight": 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
|
|
||||||
"clusterName": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul",
|
|
||||||
"endpoints": [
|
|
||||||
{
|
|
||||||
"lbEndpoints": [
|
|
||||||
{
|
|
||||||
"endpoint": {
|
|
||||||
"address": {
|
|
||||||
"socketAddress": {
|
|
||||||
"address": "10.10.1.1",
|
|
||||||
"portValue": 8080
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"healthStatus": "HEALTHY",
|
|
||||||
"loadBalancingWeight": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"endpoint": {
|
|
||||||
"address": {
|
|
||||||
"socketAddress": {
|
|
||||||
"address": "10.20.1.2",
|
|
||||||
"portValue": 8080
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"healthStatus": "HEALTHY",
|
|
||||||
"loadBalancingWeight": 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
|
|
||||||
"clusterName": "hcp-metrics-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
||||||
"endpoints": [
|
|
||||||
{
|
|
||||||
"lbEndpoints": [
|
|
||||||
{
|
|
||||||
"endpoint": {
|
|
||||||
"address": {
|
|
||||||
"socketAddress": {
|
|
||||||
"address": "9.9.9.9",
|
|
||||||
"portValue": 9090
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"healthStatus": "HEALTHY",
|
|
||||||
"loadBalancingWeight": 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"typeUrl": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
|
|
||||||
"nonce": "00000001"
|
|
||||||
}
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
{
|
||||||
|
"versionInfo": "00000001",
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
|
||||||
|
"clusterName": "consul-telemetry-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
||||||
|
"endpoints": [
|
||||||
|
{
|
||||||
|
"lbEndpoints": [
|
||||||
|
{
|
||||||
|
"endpoint": {
|
||||||
|
"address": {
|
||||||
|
"socketAddress": {
|
||||||
|
"address": "9.9.9.9",
|
||||||
|
"portValue": 9090
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"healthStatus": "HEALTHY",
|
||||||
|
"loadBalancingWeight": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
|
||||||
|
"clusterName": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
||||||
|
"endpoints": [
|
||||||
|
{
|
||||||
|
"lbEndpoints": [
|
||||||
|
{
|
||||||
|
"endpoint": {
|
||||||
|
"address": {
|
||||||
|
"socketAddress": {
|
||||||
|
"address": "10.10.1.1",
|
||||||
|
"portValue": 8080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"healthStatus": "HEALTHY",
|
||||||
|
"loadBalancingWeight": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"endpoint": {
|
||||||
|
"address": {
|
||||||
|
"socketAddress": {
|
||||||
|
"address": "10.10.1.2",
|
||||||
|
"portValue": 8080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"healthStatus": "HEALTHY",
|
||||||
|
"loadBalancingWeight": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
|
||||||
|
"clusterName": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul",
|
||||||
|
"endpoints": [
|
||||||
|
{
|
||||||
|
"lbEndpoints": [
|
||||||
|
{
|
||||||
|
"endpoint": {
|
||||||
|
"address": {
|
||||||
|
"socketAddress": {
|
||||||
|
"address": "10.10.1.1",
|
||||||
|
"portValue": 8080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"healthStatus": "HEALTHY",
|
||||||
|
"loadBalancingWeight": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"endpoint": {
|
||||||
|
"address": {
|
||||||
|
"socketAddress": {
|
||||||
|
"address": "10.20.1.2",
|
||||||
|
"portValue": 8080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"healthStatus": "HEALTHY",
|
||||||
|
"loadBalancingWeight": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"typeUrl": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
|
||||||
|
"nonce": "00000001"
|
||||||
|
}
|
|
@ -3,35 +3,10 @@
|
||||||
"resources": [
|
"resources": [
|
||||||
{
|
{
|
||||||
"@type": "type.googleapis.com/envoy.config.listener.v3.Listener",
|
"@type": "type.googleapis.com/envoy.config.listener.v3.Listener",
|
||||||
"name": "db:127.0.0.1:9191",
|
"name": "consul-telemetry-collector:/tmp/consul/telemetry-collector/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock",
|
||||||
"address": {
|
|
||||||
"socketAddress": {
|
|
||||||
"address": "127.0.0.1",
|
|
||||||
"portValue": 9191
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"filterChains": [
|
|
||||||
{
|
|
||||||
"filters": [
|
|
||||||
{
|
|
||||||
"name": "envoy.filters.network.tcp_proxy",
|
|
||||||
"typedConfig": {
|
|
||||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
|
|
||||||
"statPrefix": "upstream.db.default.default.dc1",
|
|
||||||
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"trafficDirection": "OUTBOUND"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/envoy.config.listener.v3.Listener",
|
|
||||||
"name": "hcp-metrics-collector:/tmp/consul/hcp-metrics/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock",
|
|
||||||
"address": {
|
"address": {
|
||||||
"pipe": {
|
"pipe": {
|
||||||
"path": "/tmp/consul/hcp-metrics/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock"
|
"path": "/tmp/consul/telemetry-collector/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"filterChains": [
|
"filterChains": [
|
||||||
|
@ -41,12 +16,12 @@
|
||||||
"name": "envoy.filters.network.http_connection_manager",
|
"name": "envoy.filters.network.http_connection_manager",
|
||||||
"typedConfig": {
|
"typedConfig": {
|
||||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||||
"statPrefix": "upstream.hcp-metrics-collector.default.default.dc1",
|
"statPrefix": "upstream.consul-telemetry-collector.default.default.dc1",
|
||||||
"routeConfig": {
|
"routeConfig": {
|
||||||
"name": "hcp-metrics-collector",
|
"name": "consul-telemetry-collector",
|
||||||
"virtualHosts": [
|
"virtualHosts": [
|
||||||
{
|
{
|
||||||
"name": "hcp-metrics-collector.default.default.dc1",
|
"name": "consul-telemetry-collector.default.default.dc1",
|
||||||
"domains": [
|
"domains": [
|
||||||
"*"
|
"*"
|
||||||
],
|
],
|
||||||
|
@ -56,7 +31,7 @@
|
||||||
"prefix": "/"
|
"prefix": "/"
|
||||||
},
|
},
|
||||||
"route": {
|
"route": {
|
||||||
"cluster": "hcp-metrics-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
|
"cluster": "consul-telemetry-collector.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -95,6 +70,31 @@
|
||||||
],
|
],
|
||||||
"trafficDirection": "OUTBOUND"
|
"trafficDirection": "OUTBOUND"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"@type": "type.googleapis.com/envoy.config.listener.v3.Listener",
|
||||||
|
"name": "db:127.0.0.1:9191",
|
||||||
|
"address": {
|
||||||
|
"socketAddress": {
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"portValue": 9191
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"filterChains": [
|
||||||
|
{
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "envoy.filters.network.tcp_proxy",
|
||||||
|
"typedConfig": {
|
||||||
|
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
|
||||||
|
"statPrefix": "upstream.db.default.default.dc1",
|
||||||
|
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"trafficDirection": "OUTBOUND"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"@type": "type.googleapis.com/envoy.config.listener.v3.Listener",
|
"@type": "type.googleapis.com/envoy.config.listener.v3.Listener",
|
||||||
"name": "prepared_query:geo-cache:127.10.10.10:8181",
|
"name": "prepared_query:geo-cache:127.10.10.10:8181",
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
package api
|
package api
|
||||||
|
|
||||||
// HCPMetricsCollectorName is the service name for the HCP Metrics Collector
|
// TelemetryCollectorName is the service name for the Consul Telemetry Collector
|
||||||
const HCPMetricsCollectorName string = "hcp-metrics-collector"
|
const TelemetryCollectorName string = "consul-telemetry-collector"
|
||||||
|
|
||||||
// Connect can be used to work with endpoints related to Connect, the
|
// Connect can be used to work with endpoints related to Connect, the
|
||||||
// feature for securely connecting services within Consul.
|
// feature for securely connecting services within Consul.
|
||||||
|
|
|
@ -55,10 +55,10 @@ type BootstrapConfig struct {
|
||||||
// stats_config.stats_tags can be made by overriding envoy_stats_config_json.
|
// stats_config.stats_tags can be made by overriding envoy_stats_config_json.
|
||||||
StatsTags []string `mapstructure:"envoy_stats_tags"`
|
StatsTags []string `mapstructure:"envoy_stats_tags"`
|
||||||
|
|
||||||
// HCPMetricsBindSocketDir is a string that configures the directory for a
|
// TelemetryCollectorBindSocketDir is a string that configures the directory for a
|
||||||
// unix socket where Envoy will forward metrics. These metrics get pushed to
|
// unix socket where Envoy will forward metrics. These metrics get pushed to
|
||||||
// the HCP Metrics collector to show service mesh metrics on HCP.
|
// the telemetry collector.
|
||||||
HCPMetricsBindSocketDir string `mapstructure:"envoy_hcp_metrics_bind_socket_dir"`
|
TelemetryCollectorBindSocketDir string `mapstructure:"envoy_telemetry_collector_bind_socket_dir"`
|
||||||
|
|
||||||
// PrometheusBindAddr configures an <ip>:<port> on which the Envoy will listen
|
// PrometheusBindAddr configures an <ip>:<port> on which the Envoy will listen
|
||||||
// and expose a single /metrics HTTP endpoint for Prometheus to scrape. It
|
// and expose a single /metrics HTTP endpoint for Prometheus to scrape. It
|
||||||
|
@ -249,9 +249,9 @@ func (c *BootstrapConfig) ConfigureArgs(args *BootstrapTplArgs, omitDeprecatedTa
|
||||||
args.StatsFlushInterval = c.StatsFlushInterval
|
args.StatsFlushInterval = c.StatsFlushInterval
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup HCP Metrics if needed. This MUST happen after the Static*JSON is set above
|
// Setup telemetry collector if needed. This MUST happen after the Static*JSON is set above
|
||||||
if c.HCPMetricsBindSocketDir != "" {
|
if c.TelemetryCollectorBindSocketDir != "" {
|
||||||
appendHCPMetricsConfig(args, c.HCPMetricsBindSocketDir)
|
appendTelemetryCollectorConfig(args, c.TelemetryCollectorBindSocketDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -812,16 +812,16 @@ func (c *BootstrapConfig) generateListenerConfig(args *BootstrapTplArgs, bindAdd
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// appendHCPMetricsConfig generates config to enable a socket at path: <hcpMetricsBindSocketDir>/<hash of compound proxy ID>.sock
|
// appendTelemetryCollectorConfig generates config to enable a socket at path: <TelemetryCollectorBindSocketDir>/<hash of compound proxy ID>.sock
|
||||||
// We take the hash of the compound proxy ID for a few reasons:
|
// We take the hash of the compound proxy ID for a few reasons:
|
||||||
//
|
//
|
||||||
// - The proxy ID is included because this socket path must be unique per proxy. Each Envoy proxy will ship
|
// - The proxy ID is included because this socket path must be unique per proxy. Each Envoy proxy will ship
|
||||||
// its metrics to HCP using its own loopback listener at this path.
|
// its metrics to the collector using its own loopback listener at this path.
|
||||||
//
|
//
|
||||||
// - The hash is needed because UNIX domain socket paths must be less than 104 characters. By using a b64 encoded
|
// - The hash is needed because UNIX domain socket paths must be less than 104 characters. By using a b64 encoded
|
||||||
// SHA1 hash we end up with 27 chars for the name, 5 chars for the extension, and the remainder is saved for
|
// SHA1 hash we end up with 27 chars for the name, 5 chars for the extension, and the remainder is saved for
|
||||||
// the configurable socket dir. The length of the directory's path is validated on writes to avoid going over.
|
// the configurable socket dir. The length of the directory's path is validated on writes to avoid going over.
|
||||||
func appendHCPMetricsConfig(args *BootstrapTplArgs, hcpMetricsBindSocketDir string) {
|
func appendTelemetryCollectorConfig(args *BootstrapTplArgs, telemetryCollectorBindSocketDir string) {
|
||||||
// Normalize namespace to "default". This ensures we match the namespace behaviour in proxycfg package,
|
// Normalize namespace to "default". This ensures we match the namespace behaviour in proxycfg package,
|
||||||
// where a dynamic listener will be created at the same socket path via xDS.
|
// where a dynamic listener will be created at the same socket path via xDS.
|
||||||
ns := args.Namespace
|
ns := args.Namespace
|
||||||
|
@ -833,7 +833,7 @@ func appendHCPMetricsConfig(args *BootstrapTplArgs, hcpMetricsBindSocketDir stri
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
h.Write([]byte(id))
|
h.Write([]byte(id))
|
||||||
hash := base64.RawURLEncoding.EncodeToString(h.Sum(nil))
|
hash := base64.RawURLEncoding.EncodeToString(h.Sum(nil))
|
||||||
path := path.Join(hcpMetricsBindSocketDir, hash+".sock")
|
path := path.Join(telemetryCollectorBindSocketDir, hash+".sock")
|
||||||
|
|
||||||
if args.StatsSinksJSON != "" {
|
if args.StatsSinksJSON != "" {
|
||||||
args.StatsSinksJSON += ",\n"
|
args.StatsSinksJSON += ",\n"
|
||||||
|
@ -845,7 +845,7 @@ func appendHCPMetricsConfig(args *BootstrapTplArgs, hcpMetricsBindSocketDir stri
|
||||||
"transport_api_version": "V3",
|
"transport_api_version": "V3",
|
||||||
"grpc_service": {
|
"grpc_service": {
|
||||||
"envoy_grpc": {
|
"envoy_grpc": {
|
||||||
"cluster_name": "hcp_metrics_collector"
|
"cluster_name": "consul_telemetry_collector_loopback"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -855,11 +855,11 @@ func appendHCPMetricsConfig(args *BootstrapTplArgs, hcpMetricsBindSocketDir stri
|
||||||
args.StaticClustersJSON += ",\n"
|
args.StaticClustersJSON += ",\n"
|
||||||
}
|
}
|
||||||
args.StaticClustersJSON += fmt.Sprintf(`{
|
args.StaticClustersJSON += fmt.Sprintf(`{
|
||||||
"name": "hcp_metrics_collector",
|
"name": "consul_telemetry_collector_loopback",
|
||||||
"type": "STATIC",
|
"type": "STATIC",
|
||||||
"http2_protocol_options": {},
|
"http2_protocol_options": {},
|
||||||
"loadAssignment": {
|
"loadAssignment": {
|
||||||
"clusterName": "hcp_metrics_collector",
|
"clusterName": "consul_telemetry_collector_loopback",
|
||||||
"endpoints": [
|
"endpoints": [
|
||||||
{
|
{
|
||||||
"lbEndpoints": [
|
"lbEndpoints": [
|
||||||
|
|
|
@ -530,25 +530,25 @@ const (
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
expectedHCPMetricsStatsSink = `{
|
expectedTelemetryCollectorStatsSink = `{
|
||||||
"name": "envoy.stat_sinks.metrics_service",
|
"name": "envoy.stat_sinks.metrics_service",
|
||||||
"typed_config": {
|
"typed_config": {
|
||||||
"@type": "type.googleapis.com/envoy.config.metrics.v3.MetricsServiceConfig",
|
"@type": "type.googleapis.com/envoy.config.metrics.v3.MetricsServiceConfig",
|
||||||
"transport_api_version": "V3",
|
"transport_api_version": "V3",
|
||||||
"grpc_service": {
|
"grpc_service": {
|
||||||
"envoy_grpc": {
|
"envoy_grpc": {
|
||||||
"cluster_name": "hcp_metrics_collector"
|
"cluster_name": "consul_telemetry_collector_loopback"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
expectedHCPMetricsCluster = `{
|
expectedTelemetryCollectorCluster = `{
|
||||||
"name": "hcp_metrics_collector",
|
"name": "consul_telemetry_collector_loopback",
|
||||||
"type": "STATIC",
|
"type": "STATIC",
|
||||||
"http2_protocol_options": {},
|
"http2_protocol_options": {},
|
||||||
"loadAssignment": {
|
"loadAssignment": {
|
||||||
"clusterName": "hcp_metrics_collector",
|
"clusterName": "consul_telemetry_collector_loopback",
|
||||||
"endpoints": [
|
"endpoints": [
|
||||||
{
|
{
|
||||||
"lbEndpoints": [
|
"lbEndpoints": [
|
||||||
|
@ -556,7 +556,7 @@ const (
|
||||||
"endpoint": {
|
"endpoint": {
|
||||||
"address": {
|
"address": {
|
||||||
"pipe": {
|
"pipe": {
|
||||||
"path": "/tmp/consul/hcp-metrics/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock"
|
"path": "/tmp/consul/telemetry-collector/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,12 +619,12 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "hcp-metrics-sink",
|
name: "telemetry-collector-sink",
|
||||||
baseArgs: BootstrapTplArgs{
|
baseArgs: BootstrapTplArgs{
|
||||||
ProxyID: "web-sidecar-proxy",
|
ProxyID: "web-sidecar-proxy",
|
||||||
},
|
},
|
||||||
input: BootstrapConfig{
|
input: BootstrapConfig{
|
||||||
HCPMetricsBindSocketDir: "/tmp/consul/hcp-metrics",
|
TelemetryCollectorBindSocketDir: "/tmp/consul/telemetry-collector",
|
||||||
},
|
},
|
||||||
wantArgs: BootstrapTplArgs{
|
wantArgs: BootstrapTplArgs{
|
||||||
ProxyID: "web-sidecar-proxy",
|
ProxyID: "web-sidecar-proxy",
|
||||||
|
@ -636,17 +636,17 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) {
|
||||||
"transport_api_version": "V3",
|
"transport_api_version": "V3",
|
||||||
"grpc_service": {
|
"grpc_service": {
|
||||||
"envoy_grpc": {
|
"envoy_grpc": {
|
||||||
"cluster_name": "hcp_metrics_collector"
|
"cluster_name": "consul_telemetry_collector_loopback"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
StaticClustersJSON: `{
|
StaticClustersJSON: `{
|
||||||
"name": "hcp_metrics_collector",
|
"name": "consul_telemetry_collector_loopback",
|
||||||
"type": "STATIC",
|
"type": "STATIC",
|
||||||
"http2_protocol_options": {},
|
"http2_protocol_options": {},
|
||||||
"loadAssignment": {
|
"loadAssignment": {
|
||||||
"clusterName": "hcp_metrics_collector",
|
"clusterName": "consul_telemetry_collector_loopback",
|
||||||
"endpoints": [
|
"endpoints": [
|
||||||
{
|
{
|
||||||
"lbEndpoints": [
|
"lbEndpoints": [
|
||||||
|
@ -654,7 +654,7 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) {
|
||||||
"endpoint": {
|
"endpoint": {
|
||||||
"address": {
|
"address": {
|
||||||
"pipe": {
|
"pipe": {
|
||||||
"path": "/tmp/consul/hcp-metrics/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock"
|
"path": "/tmp/consul/telemetry-collector/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1631,7 +1631,7 @@ func TestConsulTagSpecifiers(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAppendHCPMetrics(t *testing.T) {
|
func TestAppendTelemetryCollectorMetrics(t *testing.T) {
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
inputArgs *BootstrapTplArgs
|
inputArgs *BootstrapTplArgs
|
||||||
bindSocketDir string
|
bindSocketDir string
|
||||||
|
@ -1641,22 +1641,22 @@ func TestAppendHCPMetrics(t *testing.T) {
|
||||||
inputArgs: &BootstrapTplArgs{
|
inputArgs: &BootstrapTplArgs{
|
||||||
ProxyID: "web-sidecar-proxy",
|
ProxyID: "web-sidecar-proxy",
|
||||||
},
|
},
|
||||||
bindSocketDir: "/tmp/consul/hcp-metrics",
|
bindSocketDir: "/tmp/consul/telemetry-collector",
|
||||||
wantArgs: &BootstrapTplArgs{
|
wantArgs: &BootstrapTplArgs{
|
||||||
ProxyID: "web-sidecar-proxy",
|
ProxyID: "web-sidecar-proxy",
|
||||||
StatsSinksJSON: expectedHCPMetricsStatsSink,
|
StatsSinksJSON: expectedTelemetryCollectorStatsSink,
|
||||||
StaticClustersJSON: expectedHCPMetricsCluster,
|
StaticClustersJSON: expectedTelemetryCollectorCluster,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"dir-with-trailing-slash": {
|
"dir-with-trailing-slash": {
|
||||||
inputArgs: &BootstrapTplArgs{
|
inputArgs: &BootstrapTplArgs{
|
||||||
ProxyID: "web-sidecar-proxy",
|
ProxyID: "web-sidecar-proxy",
|
||||||
},
|
},
|
||||||
bindSocketDir: "/tmp/consul/hcp-metrics",
|
bindSocketDir: "/tmp/consul/telemetry-collector",
|
||||||
wantArgs: &BootstrapTplArgs{
|
wantArgs: &BootstrapTplArgs{
|
||||||
ProxyID: "web-sidecar-proxy",
|
ProxyID: "web-sidecar-proxy",
|
||||||
StatsSinksJSON: expectedHCPMetricsStatsSink,
|
StatsSinksJSON: expectedTelemetryCollectorStatsSink,
|
||||||
StaticClustersJSON: expectedHCPMetricsCluster,
|
StaticClustersJSON: expectedTelemetryCollectorCluster,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"append-clusters-and-stats-sink": {
|
"append-clusters-and-stats-sink": {
|
||||||
|
@ -1665,18 +1665,18 @@ func TestAppendHCPMetrics(t *testing.T) {
|
||||||
StatsSinksJSON: expectedStatsdSink,
|
StatsSinksJSON: expectedStatsdSink,
|
||||||
StaticClustersJSON: expectedSelfAdminCluster,
|
StaticClustersJSON: expectedSelfAdminCluster,
|
||||||
},
|
},
|
||||||
bindSocketDir: "/tmp/consul/hcp-metrics",
|
bindSocketDir: "/tmp/consul/telemetry-collector",
|
||||||
wantArgs: &BootstrapTplArgs{
|
wantArgs: &BootstrapTplArgs{
|
||||||
ProxyID: "web-sidecar-proxy",
|
ProxyID: "web-sidecar-proxy",
|
||||||
StatsSinksJSON: expectedStatsdSink + ",\n" + expectedHCPMetricsStatsSink,
|
StatsSinksJSON: expectedStatsdSink + ",\n" + expectedTelemetryCollectorStatsSink,
|
||||||
StaticClustersJSON: expectedSelfAdminCluster + ",\n" + expectedHCPMetricsCluster,
|
StaticClustersJSON: expectedSelfAdminCluster + ",\n" + expectedTelemetryCollectorCluster,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, tt := range tests {
|
for name, tt := range tests {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
appendHCPMetricsConfig(tt.inputArgs, tt.bindSocketDir)
|
appendTelemetryCollectorConfig(tt.inputArgs, tt.bindSocketDir)
|
||||||
|
|
||||||
// Some of our JSON strings are comma separated objects to be
|
// Some of our JSON strings are comma separated objects to be
|
||||||
// insertedinto an array which is not valid JSON on it's own so wrap
|
// insertedinto an array which is not valid JSON on it's own so wrap
|
||||||
|
|
|
@ -199,10 +199,10 @@ func TestGenerateConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "hcp-metrics",
|
Name: "telemetry-collector",
|
||||||
Flags: []string{"-proxy-id", "test-proxy"},
|
Flags: []string{"-proxy-id", "test-proxy"},
|
||||||
ProxyConfig: map[string]interface{}{
|
ProxyConfig: map[string]interface{}{
|
||||||
"envoy_hcp_metrics_bind_socket_dir": "/tmp/consul/hcp-metrics",
|
"envoy_telemetry_collector_bind_socket_dir": "/tmp/consul/telemetry-collector",
|
||||||
},
|
},
|
||||||
WantArgs: BootstrapTplArgs{
|
WantArgs: BootstrapTplArgs{
|
||||||
ProxyCluster: "test-proxy",
|
ProxyCluster: "test-proxy",
|
||||||
|
|
|
@ -55,11 +55,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hcp_metrics_collector",
|
"name": "consul_telemetry_collector_loopback",
|
||||||
"type": "STATIC",
|
"type": "STATIC",
|
||||||
"http2_protocol_options": {},
|
"http2_protocol_options": {},
|
||||||
"loadAssignment": {
|
"loadAssignment": {
|
||||||
"clusterName": "hcp_metrics_collector",
|
"clusterName": "consul_telemetry_collector_loopback",
|
||||||
"endpoints": [
|
"endpoints": [
|
||||||
{
|
{
|
||||||
"lbEndpoints": [
|
"lbEndpoints": [
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
"endpoint": {
|
"endpoint": {
|
||||||
"address": {
|
"address": {
|
||||||
"pipe": {
|
"pipe": {
|
||||||
"path": "/tmp/consul/hcp-metrics/k3bWnyJyKvjUYXrBdOX2nXzSSCQ.sock"
|
"path": "/tmp/consul/telemetry-collector/k3bWnyJyKvjUYXrBdOX2nXzSSCQ.sock"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
"transport_api_version": "V3",
|
"transport_api_version": "V3",
|
||||||
"grpc_service": {
|
"grpc_service": {
|
||||||
"envoy_grpc": {
|
"envoy_grpc": {
|
||||||
"cluster_name": "hcp_metrics_collector"
|
"cluster_name": "consul_telemetry_collector_loopback"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -75,10 +75,6 @@ Usage: `consul connect envoy [options] [-- pass-through options]`
|
||||||
In cases where either assumption is violated this flag will prevent the
|
In cases where either assumption is violated this flag will prevent the
|
||||||
command attempting to resolve config from the local agent.
|
command attempting to resolve config from the local agent.
|
||||||
|
|
||||||
- `envoy_hcp_metrics_bind_socket_dir` - Specifies the directory where Envoy creates a unix socket.
|
|
||||||
Envoy sends metrics to the socket so that HCP collectors can connect to collect them."
|
|
||||||
The socket is not configured by default.
|
|
||||||
|
|
||||||
- `-envoy-ready-bind-address` - By default the proxy does not have a readiness probe
|
- `-envoy-ready-bind-address` - By default the proxy does not have a readiness probe
|
||||||
configured on it. This flag in conjunction with the `envoy-ready-bind-port` flag
|
configured on it. This flag in conjunction with the `envoy-ready-bind-port` flag
|
||||||
configures where the envoy readiness probe is configured on the proxy. A `/ready` HTTP
|
configures where the envoy readiness probe is configured on the proxy. A `/ready` HTTP
|
||||||
|
|
|
@ -190,6 +190,10 @@ the [`sidecar_service`](/consul/docs/connect/registration/sidecar-service) block
|
||||||
- `envoy_stats_flush_interval` - Configures Envoy's
|
- `envoy_stats_flush_interval` - Configures Envoy's
|
||||||
[`stats_flush_interval`](https://www.envoyproxy.io/docs/envoy/v1.17.2/api-v3/config/bootstrap/v3/bootstrap.proto#envoy-v3-api-field-config-bootstrap-v3-bootstrap-stats-flush-interval).
|
[`stats_flush_interval`](https://www.envoyproxy.io/docs/envoy/v1.17.2/api-v3/config/bootstrap/v3/bootstrap.proto#envoy-v3-api-field-config-bootstrap-v3-bootstrap-stats-flush-interval).
|
||||||
|
|
||||||
|
- `envoy_telemetry_collector_bind_socket_dir` - Specifies the directory where Envoy creates a Unix socket.
|
||||||
|
Envoy sends metrics to the socket where a Consul telemetry collector can collect them.
|
||||||
|
The socket is not configured by default.
|
||||||
|
|
||||||
The [Advanced Configuration](#advanced-configuration) section describes additional configurations that allow incremental or complete control over the bootstrap configuration generated.
|
The [Advanced Configuration](#advanced-configuration) section describes additional configurations that allow incremental or complete control over the bootstrap configuration generated.
|
||||||
|
|
||||||
### Bootstrap Envoy on Windows VMs
|
### Bootstrap Envoy on Windows VMs
|
||||||
|
|
Loading…
Reference in New Issue