docs/tests for multiple HTTP address config (#11760)

This commit is contained in:
Tim Gross 2022-01-03 10:17:13 -05:00 committed by GitHub
parent 5d9a506bc0
commit 2806dc2bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

3
.changelog/11582.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
agent/config: Allow binding the HTTP server to multiple addresses.
```

View File

@ -1373,9 +1373,15 @@ func TestParseMultipleIPTemplates(t *testing.T) {
expectErr bool expectErr bool
}{ }{
{ {
name: "deduplicates same ip", name: "deduplicates same ip and preserves order",
tmpl: "127.0.0.1 127.0.0.1", tmpl: "127.0.0.1 10.0.0.1 127.0.0.1",
expectedOut: []string{"127.0.0.1"}, expectedOut: []string{"127.0.0.1", "10.0.0.1"},
expectErr: false,
},
{
name: "includes sockaddr expression",
tmpl: "10.0.0.1 {{ GetAllInterfaces | include \"flags\" \"loopback\" | limit 1 | attr \"address\" }} 10.0.0.2",
expectedOut: []string{"10.0.0.1", "127.0.0.1", "10.0.0.2"},
expectErr: false, expectErr: false,
}, },
} }

View File

@ -67,7 +67,7 @@ type TestAgent struct {
Key string Key string
// All HTTP servers started. Used to prevent server leaks and preserve // All HTTP servers started. Used to prevent server leaks and preserve
// backwards compability. // backwards compatibility.
Servers []*HTTPServer Servers []*HTTPServer
// Server is a reference to the primary, started HTTP endpoint. // Server is a reference to the primary, started HTTP endpoint.

View File

@ -88,8 +88,9 @@ testing.
see the [`ports`](#ports) field. The values support [go-sockaddr/template see the [`ports`](#ports) field. The values support [go-sockaddr/template
format][go-sockaddr/template]. format][go-sockaddr/template].
- `http` - The address the HTTP server is bound to. This is the most common - `http` - The address the HTTP server is bound to. This is the most
bind address to change. common bind address to change. The `http` field accepts multiple
values, separated by spaces, to bind to multiple addresses.
- `rpc` - The address to bind the internal RPC interfaces to. Should be - `rpc` - The address to bind the internal RPC interfaces to. Should be
exposed only to other cluster members if possible. exposed only to other cluster members if possible.