Skip to content

Commit e83f615

Browse files
author
Otto van der Schaaf
committed
Review feedback & some more polish
Signed-off-by: Otto van der Schaaf <[email protected]>
1 parent ab4439f commit e83f615

File tree

2 files changed

+43
-29
lines changed

2 files changed

+43
-29
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Hitting multiple endpoints with a traffic profile
2+
3+
## Description
4+
5+
Below is an example which will send requests to two endpoints (`127.0.0.1:80` and `127.0.0.2:80`), while alternating between two request headers which contain different paths and hosts.
6+
7+
## Practical use
8+
9+
This example has been useful to test a mesh that exposed multiple endpoints, which in turn would offer access to multiple applications via different hosts/paths.
10+
11+
## Features used
12+
13+
This example illustrates the following features:
14+
15+
- [Request Source](https://github.com/envoyproxy/nighthawk/blob/261abb62c40afbdebb317f320fe67f1a1da1838f/api/request_source/request_source_plugin.proto#L15) (specifically the file-based implementation).
16+
- [Multi-targetting](https://github.com/envoyproxy/nighthawk/blob/261abb62c40afbdebb317f320fe67f1a1da1838f/api/client/options.proto#L84)
17+
18+
## Steps
19+
20+
### Configure the file based request source
21+
22+
Place a file called `traffic-profile.yaml` in your current working directory. This will act as your configuration for the file-based request source.
23+
24+
25+
```yaml
26+
options:
27+
- request_method: 1
28+
request_headers:
29+
- { header: { key: ":path", value: "/foo" } }
30+
- { header: { key: ":authority", value: "foo.com" } }
31+
- request_method: 1
32+
request_headers:
33+
- { header: { key: ":path", value: "/bar" } }
34+
- { header: { key: ":authority", value: "bar.com" } }
35+
```
36+
37+
### Configure the CLI
38+
39+
Below is a minimal CLI example which will consume the file based request source configuration created above, and hit multiple endpoints.
40+
41+
```bash
42+
bazel-bin/nighthawk_client --request-source-plugin-config "{name:\"nighthawk.file-based-request-source-plugin\",typed_config:{\"@type\":\"type.googleapis.com/nighthawk.request_source.FileBasedOptionsListRequestSourceConfig\",file_path:\"traffic-profile.yaml\",}}" --multi-target-endpoint 127.0.0.1:80 --multi-target-endpoint 127.0.0.2:80 --multi-target-path /
43+
```

examples/MULTIPLE_ENDPOINTS.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)