-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Global ShadowMod Signed-off-by: Jesper Söderlund <[email protected]> * Adding shadow-mode issue #293 Signed-off-by: Jesper Söderlund <[email protected]> * Fix doc format Signed-off-by: Jesper Söderlund <[email protected]> * Extended example to showcase shadow mode as well, build a docker image with the current rate limit, extend envoy config to display rate limit headers. Extend statsd to show shadow mode Signed-off-by: Jesper Söderlund <[email protected]> * Fine tuning of docs and example Signed-off-by: Jesper Söderlund <[email protected]> * Added integration tests, fixed some review comments Signed-off-by: Jesper Söderlund <[email protected]> * Doc format fix Signed-off-by: Jesper Söderlund <[email protected]> * gitignore for vscode Signed-off-by: Jesper Söderlund <[email protected]> Co-authored-by: Jesper Söderlund <[email protected]>
- Loading branch information
1 parent
35b6056
commit 1c1d46e
Showing
30 changed files
with
871 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ cover.out | |
|
||
bin/ | ||
.idea/ | ||
.vscode/ | ||
vendor | ||
cert.pem | ||
key.pem | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM alpine:latest | ||
|
||
USER root | ||
|
||
RUN apk update && apk upgrade && apk add bash curl sed grep | ||
|
||
ENTRYPOINT [ "bash" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
version: "3" | ||
services: | ||
redis: | ||
image: redis:alpine | ||
expose: | ||
- 6379 | ||
ports: | ||
- 6379:6379 | ||
networks: | ||
- ratelimit-network | ||
|
||
statsd: | ||
image: prom/statsd-exporter:v0.18.0 | ||
entrypoint: /bin/statsd_exporter | ||
command: | ||
- "--statsd.mapping-config=/etc/statsd-exporter/conf.yaml" | ||
expose: | ||
- 9125 | ||
- 9102 | ||
ports: | ||
- 9125:9125 | ||
- 9102:9102 # Visit http://localhost:9102/metrics to see metrics in Prometheus format | ||
networks: | ||
- ratelimit-network | ||
volumes: | ||
- ./examples/prom-statsd-exporter/conf.yaml:/etc/statsd-exporter/conf.yaml | ||
|
||
ratelimit: | ||
build: | ||
context: ${PWD} | ||
dockerfile: Dockerfile | ||
command: /bin/ratelimit | ||
ports: | ||
- 8080:8080 | ||
- 8081:8081 | ||
- 6070:6070 | ||
depends_on: | ||
- redis | ||
- statsd | ||
networks: | ||
- ratelimit-network | ||
volumes: | ||
- ./examples/ratelimit/config:/data/ratelimit/config | ||
environment: | ||
- USE_STATSD=true | ||
- STATSD_HOST=statsd | ||
- STATSD_PORT=9125 | ||
- LOG_LEVEL=debug | ||
- REDIS_SOCKET_TYPE=tcp | ||
- REDIS_URL=redis:6379 | ||
- RUNTIME_ROOT=/data | ||
- RUNTIME_SUBDIRECTORY=ratelimit | ||
- RUNTIME_WATCH_ROOT=false | ||
|
||
envoy-proxy: | ||
image: envoyproxy/envoy-dev:latest | ||
entrypoint: "/usr/local/bin/envoy" | ||
command: | ||
- "--service-node proxy" | ||
- "--service-cluster proxy" | ||
- "--config-path /etc/envoy/envoy.yaml" | ||
- "--concurrency 1" | ||
- "--mode serve" | ||
- "--log-level info" | ||
depends_on: | ||
- ratelimit | ||
volumes: | ||
- ./examples/envoy/proxy.yaml:/etc/envoy/envoy.yaml | ||
networks: | ||
- ratelimit-network | ||
expose: | ||
- "8888" | ||
- "8001" | ||
ports: | ||
- "8888:8888" | ||
- "8001:8001" | ||
|
||
envoy-mock: | ||
image: envoyproxy/envoy-dev:latest | ||
entrypoint: "/usr/local/bin/envoy" | ||
command: | ||
- "--service-node mock" | ||
- "--service-cluster mock" | ||
- "--config-path /etc/envoy/envoy.yaml" | ||
- "--concurrency 1" | ||
- "--mode serve" | ||
- "--log-level info" | ||
volumes: | ||
- ./examples/envoy/mock.yaml:/etc/envoy/envoy.yaml | ||
networks: | ||
- ratelimit-network | ||
expose: | ||
- "9999" | ||
ports: | ||
- "9999:9999" | ||
|
||
tester: | ||
build: | ||
context: ${PWD} | ||
dockerfile: integration-test/Dockerfile.tester | ||
depends_on: | ||
- envoy-proxy | ||
- envoy-mock | ||
command: /test/run-all.sh | ||
volumes: | ||
- ${PWD}/integration-test/:/test/ | ||
networks: | ||
- ratelimit-network | ||
|
||
networks: | ||
ratelimit-network: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
echo "Running tests" | ||
|
||
FILES=/test/scripts/* | ||
for f in $FILES | ||
do | ||
echo "Processing $f file..." | ||
# take action on each file. $f store current file name | ||
$f | ||
if [ $? -ne 0 ] ; then | ||
echo "Failed file $f" | ||
exit 1 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# Just happy path | ||
curl -s -f -H "foo: test" -H "baz: shady" http://envoy-proxy:8888/twoheader | ||
|
||
if [ $? -ne 0 ] ; then | ||
exit 1 | ||
fi |
Oops, something went wrong.