diff --git a/.changelog/17327.txt b/.changelog/17327.txt new file mode 100644 index 0000000000..24b1c28c1d --- /dev/null +++ b/.changelog/17327.txt @@ -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. + ``` \ No newline at end of file diff --git a/agent/proxycfg/connect_proxy.go b/agent/proxycfg/connect_proxy.go index 873f942ba4..4f9d4f9be4 100644 --- a/agent/proxycfg/connect_proxy.go +++ b/agent/proxycfg/connect_proxy.go @@ -112,8 +112,8 @@ func (s *handlerConnectProxy) initialize(ctx context.Context) (ConfigSnapshot, e return snap, err } - if err := s.maybeInitializeHCPMetricsWatches(ctx, snap); err != nil { - return snap, fmt.Errorf("failed to initialize HCP metrics watches: %w", err) + if err := s.maybeInitializeTelemetryCollectorWatches(ctx, snap); err != nil { + return snap, fmt.Errorf("failed to initialize telemetry collector watches: %w", err) } if s.proxyCfg.Mode == structs.ProxyModeTransparent { @@ -628,16 +628,17 @@ func (s *handlerConnectProxy) handleUpdate(ctx context.Context, u UpdateEvent, s return nil } -// hcpMetricsConfig represents the basic opaque config values for pushing telemetry to HCP. -type hcpMetricsConfig struct { - // HCPMetricsBindSocketDir is a string that configures the directory for a +// telemetryCollectorConfig represents the basic opaque config values for pushing telemetry to +// a consul telemetry collector. +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 - // the HCP Metrics collector to show service mesh metrics on HCP. - HCPMetricsBindSocketDir string `mapstructure:"envoy_hcp_metrics_bind_socket_dir"` + // the Consul Telemetry collector. + TelemetryCollectorBindSocketDir string `mapstructure:"envoy_telemetry_collector_bind_socket_dir"` } -func parseHCPMetricsConfig(m map[string]interface{}) (hcpMetricsConfig, error) { - var cfg hcpMetricsConfig +func parseTelemetryCollectorConfig(m map[string]interface{}) (telemetryCollectorConfig, error) { + var cfg telemetryCollectorConfig err := mapstructure.WeakDecode(m, &cfg) if err != nil { @@ -647,21 +648,21 @@ func parseHCPMetricsConfig(m map[string]interface{}) (hcpMetricsConfig, error) { return cfg, nil } -// maybeInitializeHCPMetricsWatches will initialize a synthetic upstream and discovery chain -// watch for the HCP metrics collector, if metrics collection is enabled on the proxy registration. -func (s *handlerConnectProxy) maybeInitializeHCPMetricsWatches(ctx context.Context, snap ConfigSnapshot) error { - hcpCfg, err := parseHCPMetricsConfig(s.proxyCfg.Config) +// maybeInitializeTelemetryCollectorWatches will initialize a synthetic upstream and discovery chain +// watch for the consul telemetry collector, if telemetry data collection is enabled on the proxy registration. +func (s *handlerConnectProxy) maybeInitializeTelemetryCollectorWatches(ctx context.Context, snap ConfigSnapshot) error { + cfg, err := parseTelemetryCollectorConfig(s.proxyCfg.Config) if err != nil { s.logger.Error("failed to parse connect.proxy.config", "error", err) } - if hcpCfg.HCPMetricsBindSocketDir == "" { - // Metrics collection is not enabled, return early. + if cfg.TelemetryCollectorBindSocketDir == "" { + // telemetry collection is not enabled, return early. return nil } // 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 // 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.Write([]byte(id)) hash := base64.RawURLEncoding.EncodeToString(h.Sum(nil)) - path := path.Join(hcpCfg.HCPMetricsBindSocketDir, hash+".sock") + path := path.Join(cfg.TelemetryCollectorBindSocketDir, hash+".sock") upstream := structs.Upstream{ DestinationNamespace: acl.DefaultNamespaceName, DestinationPartition: s.proxyID.PartitionOrDefault(), - DestinationName: api.HCPMetricsCollectorName, + DestinationName: api.TelemetryCollectorName, LocalBindSocketPath: path, Config: map[string]interface{}{ "protocol": "grpc", diff --git a/agent/proxycfg/state_test.go b/agent/proxycfg/state_test.go index f8760a5e11..dbe2db1143 100644 --- a/agent/proxycfg/state_test.go +++ b/agent/proxycfg/state_test.go @@ -467,18 +467,18 @@ func TestState_WatchesAndUpdates(t *testing.T) { // Used to account for differences in OSS/ent implementations of ServiceID.String() var ( - db = structs.NewServiceName("db", nil) - billing = structs.NewServiceName("billing", nil) - api = structs.NewServiceName("api", nil) - apiA = structs.NewServiceName("api-a", nil) - hcpCollector = structs.NewServiceName(apimod.HCPMetricsCollectorName, nil) + db = structs.NewServiceName("db", nil) + billing = structs.NewServiceName("billing", nil) + api = structs.NewServiceName("api", nil) + apiA = structs.NewServiceName("api-a", nil) + telemetryCollector = structs.NewServiceName(apimod.TelemetryCollectorName, nil) - apiUID = NewUpstreamIDFromServiceName(api) - dbUID = NewUpstreamIDFromServiceName(db) - pqUID = UpstreamIDFromString("prepared_query:query") - extApiUID = NewUpstreamIDFromServiceName(apiA) - extDBUID = NewUpstreamIDFromServiceName(db) - hcpCollectorUID = NewUpstreamIDFromServiceName(hcpCollector) + apiUID = NewUpstreamIDFromServiceName(api) + dbUID = NewUpstreamIDFromServiceName(db) + pqUID = UpstreamIDFromString("prepared_query:query") + extApiUID = NewUpstreamIDFromServiceName(apiA) + extDBUID = NewUpstreamIDFromServiceName(db) + telemetryCollectorUID = NewUpstreamIDFromServiceName(telemetryCollector) ) // TODO(peering): NewUpstreamIDFromServiceName should take a PeerName extApiUID.Peer = "peer-a" @@ -3638,7 +3638,7 @@ func TestState_WatchesAndUpdates(t *testing.T) { }, }, }, - "hcp-metrics": { + "telemetry-collector": { ns: structs.NodeService{ Kind: structs.ServiceKindConnectProxy, ID: "web-sidecar-proxy", @@ -3648,7 +3648,7 @@ func TestState_WatchesAndUpdates(t *testing.T) { Proxy: structs.ConnectProxyConfig{ DestinationServiceName: "web", 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{ { requiredWatches: map[string]verifyWatchRequest{ - fmt.Sprintf("discovery-chain:%s", hcpCollectorUID.String()): genVerifyDiscoveryChainWatch(&structs.DiscoveryChainRequest{ - Name: hcpCollector.Name, + fmt.Sprintf("discovery-chain:%s", telemetryCollectorUID.String()): genVerifyDiscoveryChainWatch(&structs.DiscoveryChainRequest{ + Name: telemetryCollector.Name, EvaluateInDatacenter: "dc1", EvaluateInNamespace: "default", EvaluateInPartition: "default", @@ -3698,9 +3698,9 @@ func TestState_WatchesAndUpdates(t *testing.T) { Result: &structs.ConfigEntryResponse{}, }, { - CorrelationID: fmt.Sprintf("discovery-chain:%s", hcpCollectorUID.String()), + CorrelationID: fmt.Sprintf("discovery-chain:%s", telemetryCollectorUID.String()), 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, }, @@ -3710,19 +3710,19 @@ func TestState_WatchesAndUpdates(t *testing.T) { require.Equal(t, indexedRoots, snap.Roots) 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.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.WatchedUpstreamEndpoints, 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints) - require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints, hcpCollectorUID) + require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints, telemetryCollectorUID) expectUpstream := structs.Upstream{ DestinationNamespace: "default", DestinationPartition: "default", - DestinationName: apimod.HCPMetricsCollectorName, - LocalBindSocketPath: "/tmp/consul/hcp-metrics/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock", + DestinationName: apimod.TelemetryCollectorName, + LocalBindSocketPath: "/tmp/consul/telemetry-collector/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock", Config: map[string]interface{}{ "protocol": "grpc", }, @@ -3733,16 +3733,16 @@ func TestState_WatchesAndUpdates(t *testing.T) { require.Equal(t, &expectUpstream, snap.ConnectProxy.UpstreamConfig[uid]) // 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{ - 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{ { - 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{ Nodes: structs.CheckServiceNodes{ { @@ -3751,8 +3751,8 @@ func TestState_WatchesAndUpdates(t *testing.T) { Address: "10.0.0.1", }, Service: &structs.NodeService{ - ID: apimod.HCPMetricsCollectorName, - Service: apimod.HCPMetricsCollectorName, + ID: apimod.TelemetryCollectorName, + Service: apimod.TelemetryCollectorName, Port: 8080, }, }, @@ -3766,16 +3766,16 @@ func TestState_WatchesAndUpdates(t *testing.T) { require.Equal(t, indexedRoots, snap.Roots) 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.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.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. - require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints[hcpCollectorUID], 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints) + // An endpoint arrived for the telemetry collector, so it should be present in the snapshot. + require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints[telemetryCollectorUID], 1, "%+v", snap.ConnectProxy.WatchedUpstreamEndpoints) nodes := structs.CheckServiceNodes{ { @@ -3784,14 +3784,14 @@ func TestState_WatchesAndUpdates(t *testing.T) { Address: "10.0.0.1", }, Service: &structs.NodeService{ - ID: apimod.HCPMetricsCollectorName, - Service: apimod.HCPMetricsCollectorName, + ID: apimod.TelemetryCollectorName, + Service: apimod.TelemetryCollectorName, Port: 8080, }, }, } - target := fmt.Sprintf("%s.default.default.dc1", apimod.HCPMetricsCollectorName) - require.Equal(t, nodes, snap.ConnectProxy.WatchedUpstreamEndpoints[hcpCollectorUID][target]) + target := fmt.Sprintf("%s.default.default.dc1", apimod.TelemetryCollectorName) + require.Equal(t, nodes, snap.ConnectProxy.WatchedUpstreamEndpoints[telemetryCollectorUID][target]) }, }, }, diff --git a/agent/proxycfg/testing_connect_proxy.go b/agent/proxycfg/testing_connect_proxy.go index c885ca6179..a929aa52f1 100644 --- a/agent/proxycfg/testing_connect_proxy.go +++ b/agent/proxycfg/testing_connect_proxy.go @@ -302,19 +302,19 @@ func TestConfigSnapshotGRPCExposeHTTP1(t testing.T) *ConfigSnapshot { }) } -// TestConfigSnapshotDiscoveryChain returns a fully populated snapshot using a discovery chain -func TestConfigSnapshotHCPMetrics(t testing.T) *ConfigSnapshot { +// TestConfigSnapshotTelemetryCollector returns a fully populated snapshot using a discovery chain +func TestConfigSnapshotTelemetryCollector(t testing.T) *ConfigSnapshot { // DiscoveryChain without an UpstreamConfig should yield a // filter chain when in transparent proxy mode var ( - collector = structs.NewServiceName(api.HCPMetricsCollectorName, nil) + collector = structs.NewServiceName(api.TelemetryCollectorName, nil) 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) { 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{ { @@ -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{ Nodes: []structs.CheckServiceNode{ { @@ -339,7 +339,7 @@ func TestConfigSnapshotHCPMetrics(t testing.T) *ConfigSnapshot { Datacenter: "dc1", }, Service: &structs.NodeService{ - Service: api.HCPMetricsCollectorName, + Service: api.TelemetryCollectorName, Address: "9.9.9.9", Port: 9090, }, diff --git a/agent/xds/resources_test.go b/agent/xds/resources_test.go index 5028cc67e4..9204a990a2 100644 --- a/agent/xds/resources_test.go +++ b/agent/xds/resources_test.go @@ -172,8 +172,8 @@ func TestAllResourcesFromSnapshot(t *testing.T) { create: proxycfg.TestConfigSnapshotPeeringLocalMeshGateway, }, { - name: "hcp-metrics", - create: proxycfg.TestConfigSnapshotHCPMetrics, + name: "telemetry-collector", + create: proxycfg.TestConfigSnapshotTelemetryCollector, }, } tests = append(tests, getConnectProxyTransparentProxyGoldenTestCases()...) diff --git a/agent/xds/testdata/clusters/hcp-metrics.latest.golden b/agent/xds/testdata/clusters/telemetry-collector.latest.golden similarity index 96% rename from agent/xds/testdata/clusters/hcp-metrics.latest.golden rename to agent/xds/testdata/clusters/telemetry-collector.latest.golden index 441763f1a9..0f936dbf4e 100644 --- a/agent/xds/testdata/clusters/hcp-metrics.latest.golden +++ b/agent/xds/testdata/clusters/telemetry-collector.latest.golden @@ -1,6 +1,62 @@ { "versionInfo": "00000001", "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", "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", "name": "local_app", diff --git a/agent/xds/testdata/endpoints/hcp-metrics.latest.golden b/agent/xds/testdata/endpoints/hcp-metrics.latest.golden deleted file mode 100644 index a19ac95f21..0000000000 --- a/agent/xds/testdata/endpoints/hcp-metrics.latest.golden +++ /dev/null @@ -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" -} \ No newline at end of file diff --git a/agent/xds/testdata/endpoints/telemetry-collector.latest.golden b/agent/xds/testdata/endpoints/telemetry-collector.latest.golden new file mode 100644 index 0000000000..fb14b9d3a8 --- /dev/null +++ b/agent/xds/testdata/endpoints/telemetry-collector.latest.golden @@ -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" +} \ No newline at end of file diff --git a/agent/xds/testdata/listeners/hcp-metrics.latest.golden b/agent/xds/testdata/listeners/telemetry-collector.latest.golden similarity index 93% rename from agent/xds/testdata/listeners/hcp-metrics.latest.golden rename to agent/xds/testdata/listeners/telemetry-collector.latest.golden index c1e0d04734..b97f7e0438 100644 --- a/agent/xds/testdata/listeners/hcp-metrics.latest.golden +++ b/agent/xds/testdata/listeners/telemetry-collector.latest.golden @@ -3,35 +3,10 @@ "resources": [ { "@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", - "name": "hcp-metrics-collector:/tmp/consul/hcp-metrics/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock", + "name": "consul-telemetry-collector:/tmp/consul/telemetry-collector/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock", "address": { "pipe": { - "path": "/tmp/consul/hcp-metrics/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock" + "path": "/tmp/consul/telemetry-collector/gqmuzdHCUPAEY5mbF8vgkZCNI14.sock" } }, "filterChains": [ @@ -41,12 +16,12 @@ "name": "envoy.filters.network.http_connection_manager", "typedConfig": { "@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": { - "name": "hcp-metrics-collector", + "name": "consul-telemetry-collector", "virtualHosts": [ { - "name": "hcp-metrics-collector.default.default.dc1", + "name": "consul-telemetry-collector.default.default.dc1", "domains": [ "*" ], @@ -56,7 +31,7 @@ "prefix": "/" }, "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" }, + { + "@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", "name": "prepared_query:geo-cache:127.10.10.10:8181", diff --git a/agent/xds/testdata/routes/hcp-metrics.latest.golden b/agent/xds/testdata/routes/telemetry-collector.latest.golden similarity index 100% rename from agent/xds/testdata/routes/hcp-metrics.latest.golden rename to agent/xds/testdata/routes/telemetry-collector.latest.golden diff --git a/agent/xds/testdata/secrets/hcp-metrics.latest.golden b/agent/xds/testdata/secrets/telemetry-collector.latest.golden similarity index 100% rename from agent/xds/testdata/secrets/hcp-metrics.latest.golden rename to agent/xds/testdata/secrets/telemetry-collector.latest.golden diff --git a/api/connect.go b/api/connect.go index ce23b1c038..77be00034d 100644 --- a/api/connect.go +++ b/api/connect.go @@ -3,8 +3,8 @@ package api -// HCPMetricsCollectorName is the service name for the HCP Metrics Collector -const HCPMetricsCollectorName string = "hcp-metrics-collector" +// TelemetryCollectorName is the service name for the Consul Telemetry Collector +const TelemetryCollectorName string = "consul-telemetry-collector" // Connect can be used to work with endpoints related to Connect, the // feature for securely connecting services within Consul. diff --git a/command/connect/envoy/bootstrap_config.go b/command/connect/envoy/bootstrap_config.go index 8ace2c37aa..a50eaf36fe 100644 --- a/command/connect/envoy/bootstrap_config.go +++ b/command/connect/envoy/bootstrap_config.go @@ -55,10 +55,10 @@ type BootstrapConfig struct { // stats_config.stats_tags can be made by overriding envoy_stats_config_json. 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 - // the HCP Metrics collector to show service mesh metrics on HCP. - HCPMetricsBindSocketDir string `mapstructure:"envoy_hcp_metrics_bind_socket_dir"` + // the telemetry collector. + TelemetryCollectorBindSocketDir string `mapstructure:"envoy_telemetry_collector_bind_socket_dir"` // PrometheusBindAddr configures an : on which the Envoy will listen // 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 } - // Setup HCP Metrics if needed. This MUST happen after the Static*JSON is set above - if c.HCPMetricsBindSocketDir != "" { - appendHCPMetricsConfig(args, c.HCPMetricsBindSocketDir) + // Setup telemetry collector if needed. This MUST happen after the Static*JSON is set above + if c.TelemetryCollectorBindSocketDir != "" { + appendTelemetryCollectorConfig(args, c.TelemetryCollectorBindSocketDir) } return nil @@ -812,16 +812,16 @@ func (c *BootstrapConfig) generateListenerConfig(args *BootstrapTplArgs, bindAdd return nil } -// appendHCPMetricsConfig generates config to enable a socket at path: /.sock +// appendTelemetryCollectorConfig generates config to enable a socket at path: /.sock // 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 -// 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 // 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. -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, // where a dynamic listener will be created at the same socket path via xDS. ns := args.Namespace @@ -833,7 +833,7 @@ func appendHCPMetricsConfig(args *BootstrapTplArgs, hcpMetricsBindSocketDir stri h := sha1.New() h.Write([]byte(id)) hash := base64.RawURLEncoding.EncodeToString(h.Sum(nil)) - path := path.Join(hcpMetricsBindSocketDir, hash+".sock") + path := path.Join(telemetryCollectorBindSocketDir, hash+".sock") if args.StatsSinksJSON != "" { args.StatsSinksJSON += ",\n" @@ -845,7 +845,7 @@ func appendHCPMetricsConfig(args *BootstrapTplArgs, hcpMetricsBindSocketDir stri "transport_api_version": "V3", "grpc_service": { "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 += fmt.Sprintf(`{ - "name": "hcp_metrics_collector", + "name": "consul_telemetry_collector_loopback", "type": "STATIC", "http2_protocol_options": {}, "loadAssignment": { - "clusterName": "hcp_metrics_collector", + "clusterName": "consul_telemetry_collector_loopback", "endpoints": [ { "lbEndpoints": [ diff --git a/command/connect/envoy/bootstrap_config_test.go b/command/connect/envoy/bootstrap_config_test.go index a43814c729..8de9ae007d 100644 --- a/command/connect/envoy/bootstrap_config_test.go +++ b/command/connect/envoy/bootstrap_config_test.go @@ -530,25 +530,25 @@ const ( } }` - expectedHCPMetricsStatsSink = `{ + expectedTelemetryCollectorStatsSink = `{ "name": "envoy.stat_sinks.metrics_service", "typed_config": { "@type": "type.googleapis.com/envoy.config.metrics.v3.MetricsServiceConfig", "transport_api_version": "V3", "grpc_service": { "envoy_grpc": { - "cluster_name": "hcp_metrics_collector" + "cluster_name": "consul_telemetry_collector_loopback" } } } }` - expectedHCPMetricsCluster = `{ - "name": "hcp_metrics_collector", + expectedTelemetryCollectorCluster = `{ + "name": "consul_telemetry_collector_loopback", "type": "STATIC", "http2_protocol_options": {}, "loadAssignment": { - "clusterName": "hcp_metrics_collector", + "clusterName": "consul_telemetry_collector_loopback", "endpoints": [ { "lbEndpoints": [ @@ -556,7 +556,7 @@ const ( "endpoint": { "address": { "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{ ProxyID: "web-sidecar-proxy", }, input: BootstrapConfig{ - HCPMetricsBindSocketDir: "/tmp/consul/hcp-metrics", + TelemetryCollectorBindSocketDir: "/tmp/consul/telemetry-collector", }, wantArgs: BootstrapTplArgs{ ProxyID: "web-sidecar-proxy", @@ -636,17 +636,17 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) { "transport_api_version": "V3", "grpc_service": { "envoy_grpc": { - "cluster_name": "hcp_metrics_collector" + "cluster_name": "consul_telemetry_collector_loopback" } } } }`, StaticClustersJSON: `{ - "name": "hcp_metrics_collector", + "name": "consul_telemetry_collector_loopback", "type": "STATIC", "http2_protocol_options": {}, "loadAssignment": { - "clusterName": "hcp_metrics_collector", + "clusterName": "consul_telemetry_collector_loopback", "endpoints": [ { "lbEndpoints": [ @@ -654,7 +654,7 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) { "endpoint": { "address": { "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 { inputArgs *BootstrapTplArgs bindSocketDir string @@ -1641,22 +1641,22 @@ func TestAppendHCPMetrics(t *testing.T) { inputArgs: &BootstrapTplArgs{ ProxyID: "web-sidecar-proxy", }, - bindSocketDir: "/tmp/consul/hcp-metrics", + bindSocketDir: "/tmp/consul/telemetry-collector", wantArgs: &BootstrapTplArgs{ ProxyID: "web-sidecar-proxy", - StatsSinksJSON: expectedHCPMetricsStatsSink, - StaticClustersJSON: expectedHCPMetricsCluster, + StatsSinksJSON: expectedTelemetryCollectorStatsSink, + StaticClustersJSON: expectedTelemetryCollectorCluster, }, }, "dir-with-trailing-slash": { inputArgs: &BootstrapTplArgs{ ProxyID: "web-sidecar-proxy", }, - bindSocketDir: "/tmp/consul/hcp-metrics", + bindSocketDir: "/tmp/consul/telemetry-collector", wantArgs: &BootstrapTplArgs{ ProxyID: "web-sidecar-proxy", - StatsSinksJSON: expectedHCPMetricsStatsSink, - StaticClustersJSON: expectedHCPMetricsCluster, + StatsSinksJSON: expectedTelemetryCollectorStatsSink, + StaticClustersJSON: expectedTelemetryCollectorCluster, }, }, "append-clusters-and-stats-sink": { @@ -1665,18 +1665,18 @@ func TestAppendHCPMetrics(t *testing.T) { StatsSinksJSON: expectedStatsdSink, StaticClustersJSON: expectedSelfAdminCluster, }, - bindSocketDir: "/tmp/consul/hcp-metrics", + bindSocketDir: "/tmp/consul/telemetry-collector", wantArgs: &BootstrapTplArgs{ ProxyID: "web-sidecar-proxy", - StatsSinksJSON: expectedStatsdSink + ",\n" + expectedHCPMetricsStatsSink, - StaticClustersJSON: expectedSelfAdminCluster + ",\n" + expectedHCPMetricsCluster, + StatsSinksJSON: expectedStatsdSink + ",\n" + expectedTelemetryCollectorStatsSink, + StaticClustersJSON: expectedSelfAdminCluster + ",\n" + expectedTelemetryCollectorCluster, }, }, } for name, tt := range tests { 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 // insertedinto an array which is not valid JSON on it's own so wrap diff --git a/command/connect/envoy/envoy_test.go b/command/connect/envoy/envoy_test.go index ebfc306311..d1105df0d2 100644 --- a/command/connect/envoy/envoy_test.go +++ b/command/connect/envoy/envoy_test.go @@ -199,10 +199,10 @@ func TestGenerateConfig(t *testing.T) { }, }, { - Name: "hcp-metrics", + Name: "telemetry-collector", Flags: []string{"-proxy-id", "test-proxy"}, 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{ ProxyCluster: "test-proxy", diff --git a/command/connect/envoy/testdata/hcp-metrics.golden b/command/connect/envoy/testdata/telemetry-collector.golden similarity index 96% rename from command/connect/envoy/testdata/hcp-metrics.golden rename to command/connect/envoy/testdata/telemetry-collector.golden index 4871c1cb6a..983e51633b 100644 --- a/command/connect/envoy/testdata/hcp-metrics.golden +++ b/command/connect/envoy/testdata/telemetry-collector.golden @@ -55,11 +55,11 @@ } }, { - "name": "hcp_metrics_collector", + "name": "consul_telemetry_collector_loopback", "type": "STATIC", "http2_protocol_options": {}, "loadAssignment": { - "clusterName": "hcp_metrics_collector", + "clusterName": "consul_telemetry_collector_loopback", "endpoints": [ { "lbEndpoints": [ @@ -67,7 +67,7 @@ "endpoint": { "address": { "pipe": { - "path": "/tmp/consul/hcp-metrics/k3bWnyJyKvjUYXrBdOX2nXzSSCQ.sock" + "path": "/tmp/consul/telemetry-collector/k3bWnyJyKvjUYXrBdOX2nXzSSCQ.sock" } } } @@ -87,7 +87,7 @@ "transport_api_version": "V3", "grpc_service": { "envoy_grpc": { - "cluster_name": "hcp_metrics_collector" + "cluster_name": "consul_telemetry_collector_loopback" } } } diff --git a/website/content/commands/connect/envoy.mdx b/website/content/commands/connect/envoy.mdx index 8d60e69965..a8f70c291d 100644 --- a/website/content/commands/connect/envoy.mdx +++ b/website/content/commands/connect/envoy.mdx @@ -75,10 +75,6 @@ Usage: `consul connect envoy [options] [-- pass-through options]` In cases where either assumption is violated this flag will prevent the 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 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 diff --git a/website/content/docs/connect/proxies/envoy.mdx b/website/content/docs/connect/proxies/envoy.mdx index ec2ae96ca0..65a01ca615 100644 --- a/website/content/docs/connect/proxies/envoy.mdx +++ b/website/content/docs/connect/proxies/envoy.mdx @@ -190,6 +190,10 @@ the [`sidecar_service`](/consul/docs/connect/registration/sidecar-service) block - `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). +- `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. ### Bootstrap Envoy on Windows VMs