Skip to content

Commit

Permalink
cli: Use admin bind address in self_admin cluster (#10757)
Browse files Browse the repository at this point in the history
Configure the self_admin cluster to use the admin bind address
provided when starting Envoy.

Fixes #10747
  • Loading branch information
blake committed Aug 11, 2021
1 parent bb3207d commit 6dc5096
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .changelog/10757.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:bug
cli: Ensure the metrics endpoint is accessible when Envoy is configured to use
a non-default admin bind address.
```
2 changes: 1 addition & 1 deletion command/connect/envoy/bootstrap_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ func (c *BootstrapConfig) generateListenerConfig(args *BootstrapTplArgs, bindAdd
"hosts": [
{
"socket_address": {
"address": "127.0.0.1",
"address": "` + args.AdminBindAddress + `",
"port_value": ` + args.AdminBindPort + `
}
}
Expand Down
34 changes: 34 additions & 0 deletions command/connect/envoy/bootstrap_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ const (
}
]
}`
expectedSelfAdminClusterNonLoopbackIP = `{
"name": "self_admin",
"connect_timeout": "5s",
"type": "STATIC",
"http_protocol_options": {},
"hosts": [
{
"socket_address": {
"address": "192.0.2.10",
"port_value": 19002
}
}
]
}`
expectedPromListener = `{
"name": "envoy_prometheus_metrics_listener",
"address": {
Expand Down Expand Up @@ -442,6 +456,26 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) {
},
wantErr: false,
},
{
name: "prometheus-bind-addr-non-loopback-ip",
input: BootstrapConfig{
PrometheusBindAddr: "0.0.0.0:9000",
},
baseArgs: BootstrapTplArgs{
AdminBindAddress: "192.0.2.10",
AdminBindPort: "19002",
},
wantArgs: BootstrapTplArgs{
AdminBindAddress: "192.0.2.10",
AdminBindPort: "19002",
// Should add a static cluster for the self-proxy to admin
StaticClustersJSON: expectedSelfAdminClusterNonLoopbackIP,
// Should add a static http listener too
StaticListenersJSON: expectedPromListener,
StatsConfigJSON: defaultStatsConfigJSON,
},
wantErr: false,
},
{
name: "prometheus-bind-addr-with-overrides",
input: BootstrapConfig{
Expand Down

0 comments on commit 6dc5096

Please sign in to comment.