open-consul/command/connect/envoy
Ashvitha f514182f3e
Allow HCP metrics collection for Envoy proxies
Co-authored-by: Ashvitha Sridharan <ashvitha.sridharan@hashicorp.com>
Co-authored-by: Freddy <freddygv@users.noreply.github.com>

Add a new envoy flag: "envoy_hcp_metrics_bind_socket_dir", a directory
where a unix socket will be created with the name
`<namespace>_<proxy_id>.sock` to forward Envoy metrics.

If set, this will configure:
- In bootstrap configuration a local stats_sink and static cluster.
  These will forward metrics to a loopback listener sent over xDS.

- A dynamic listener listening at the socket path that the previously
  defined static cluster is sending metrics to.

- A dynamic cluster that will forward traffic received at this listener
  to the hcp-metrics-collector service.


Reasons for having a static cluster pointing at a dynamic listener:
- We want to secure the metrics stream using TLS, but the stats sink can
  only be defined in bootstrap config. With dynamic listeners/clusters
  we can use the proxy's leaf certificate issued by the Connect CA,
  which isn't available at bootstrap time.

- We want to intelligently route to the HCP collector. Configuring its
  addreess at bootstrap time limits our flexibility routing-wise. More
  on this below.

Reasons for defining the collector as an upstream in `proxycfg`:
- The HCP collector will be deployed as a mesh service.

- Certificate management is taken care of, as mentioned above.

- Service discovery and routing logic is automatically taken care of,
  meaning that no code changes are required in the xds package.

- Custom routing rules can be added for the collector using discovery
  chain config entries. Initially the collector is expected to be
  deployed to each admin partition, but in the future could be deployed
  centrally in the default partition. These config entries could even be
  managed by HCP itself.
2023-03-10 13:52:54 -07:00
..
pipe-bootstrap envoy: improve comments 2021-06-01 11:35:32 -04:00
testdata Allow HCP metrics collection for Envoy proxies 2023-03-10 13:52:54 -07:00
bootstrap_config.go Allow HCP metrics collection for Envoy proxies 2023-03-10 13:52:54 -07:00
bootstrap_config_test.go Allow HCP metrics collection for Envoy proxies 2023-03-10 13:52:54 -07:00
bootstrap_tpl.go Allow HCP metrics collection for Envoy proxies 2023-03-10 13:52:54 -07:00
envoy.go Follow-up fixes to consul connect envoy command (#16530) 2023-03-06 10:32:06 -05:00
envoy_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
envoy_test.go Allow HCP metrics collection for Envoy proxies 2023-03-10 13:52:54 -07:00
exec.go Enhancement: Consul Compatibility Checking (#15818) 2022-12-20 09:58:19 -08:00
exec_test.go Enhancement: Consul Compatibility Checking (#15818) 2022-12-20 09:58:19 -08:00
exec_unix.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
exec_unsupported.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
flags.go connect: switch the default gateway port from 443 to 8443 (#9116) 2020-11-06 20:47:29 -05:00
flags_test.go connect: switch the default gateway port from 443 to 8443 (#9116) 2020-11-06 20:47:29 -05:00