Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove docker compose environment #100

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ SHELL := /bin/bash
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))

WASM_RELEASE_PATH = $(PROJECT_PATH)/target/wasm32-unknown-unknown/release/wasm_shim.wasm
BUILD ?= debug

WASM_RELEASE_BIN = $(PROJECT_PATH)/target/wasm32-unknown-unknown/$(BUILD)/wasm_shim.wasm
WASM_RELEASE_PATH = $(dir $(WASM_RELEASE_BIN))

PROTOC_BIN=$(PROJECT_PATH)/bin/protoc
PROTOC_VERSION=21.1
Expand All @@ -18,7 +21,6 @@ $(PROTOC_BIN):
$(call get-protoc,$(PROJECT_PATH),https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-$(PROTOC_VERSION)-$(PROTOC_OS).zip)

# builds the module and move to deploy folder
build: export BUILD?=debug
build: $(PROTOC_BIN)
@echo "Building the wasm filter"
ifeq ($(BUILD), release)
Expand Down Expand Up @@ -56,15 +58,8 @@ update-protobufs:

RUST_SOURCES := $(shell find $(PROJECT_PATH)/src -name '*.rs')

$(WASM_RELEASE_PATH): export BUILD = release
$(WASM_RELEASE_PATH): $(RUST_SOURCES)
make -C $(PROJECT_PATH) -f $(MKFILE_PATH) build

development: $(WASM_RELEASE_PATH)
docker compose up

stop-development:
docker compose down
$(WASM_RELEASE_BIN): $(RUST_SOURCES)
make -C $(PROJECT_PATH) -f $(MKFILE_PATH) build BUILD=$(BUILD)

# get-protoc will download zip from $2 and install it to $1.
define get-protoc
Expand Down
74 changes: 0 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,80 +240,6 @@ Stop and clean up resources:
make local-cleanup
```

## Running local development environment (docker-compose legacy)

`docker` and `docker-compose` required.

Run local development environment

```
make development
```

Three rate limit policies defined for e2e testing:

* `rlp-a`: Only one data item. Data selector should not generate return any value. Thus, descriptor should be empty and
rate limiting service should **not** be called.

```
curl -H "Host: test.a.com" http://127.0.0.1:18000/get
```

* `rlp-b`: Conditions do not match. Hence, rate limiting service should **not** be called.

```
curl -H "Host: test.b.com" http://127.0.0.1:18000/get
```

* `rlp-c`: Four descriptors from multiple rules should be generated. Hence, rate limiting service should be called.

```
curl -H "Host: test.c.com" -H "x-forwarded-for: 127.0.0.1" -H "My-Custom-Header-01: my-custom-header-value-01" -H "x-dyn-user-id: bob" http://127.0.0.1:18000/get
```

The expected descriptors:

```
RateLimitDescriptor { entries: [Entry { key: "limit_to_be_activated", value: "1" }], limit: None }
```

```
RateLimitDescriptor { entries: [Entry { key: "source.address", value: "127.0.0.1:0" }], limit: None }
```

```
RateLimitDescriptor { entries: [Entry { key: "request.headers.My-Custom-Header-01", value: "my-custom-header-value-01" }], limit: None }
```

```
RateLimitDescriptor { entries: [Entry { key: "user_id", value: "bob" }], limit: None }
```

**Note:**
Using [Header-To-Metadata filter](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/header_to_metadata_filter#config-http-filters-header-to-metadata), `x-dyn-user-id`
header value is available in the metadata struct with the `user-id` key.

According to the defined limits:

```yaml
---
- namespace: rlp-ns-C/rlp-name-C
max_value: 2
seconds: 10
conditions:
- "limit_to_be_activated == '1'"
- "user_id == 'bob'"
variables: [ ]
```

The third request in less than 10 seconds should return `429 Too Many Requests`.

### Clean up all resources

```
make stop-development
```

## License

[Apache 2.0 License](LICENSE)
Expand Down
37 changes: 0 additions & 37 deletions docker-compose.yaml

This file was deleted.

7 changes: 3 additions & 4 deletions make/deploy.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ kind: $(KIND) ## Download kind locally if necessary.

KIND_CLUSTER_NAME ?= wasm-auth-local

kind-create-cluster: BUILD?=debug
kind-create-cluster: WASM_PATH=$(subst /,\/,$(PROJECT_PATH)/target/wasm32-unknown-unknown/$(BUILD))
kind-create-cluster: WASM_PATH=$(subst /,\/,$(WASM_RELEASE_PATH))
kind-create-cluster: kind ## Create the "wasm-auth-local" kind cluster.
@{ \
TEMP_FILE=/tmp/kind-cluster-$$(openssl rand -hex 4).yaml ;\
Expand Down Expand Up @@ -66,7 +65,7 @@ deploy-authorino: certs sed ## Deploys an instance of Authorino into the Kuberne
##@ Limitador

deploy-limitador:
kubectl create configmap limits --from-file=$(PROJECT_PATH)/utils/docker-compose/limits.yaml
kubectl create configmap limits --from-file=$(PROJECT_PATH)/utils/deploy/limits.yaml
kubectl -n $(NAMESPACE) apply -f $(PROJECT_PATH)/utils/deploy/limitador.yaml


Expand Down Expand Up @@ -98,7 +97,7 @@ local-setup: local-env-setup
echo "After that, you can curl -H \"Host: myhost.com\" localhost:8000"; \
}

local-env-setup:
local-env-setup: $(WASM_RELEASE_BIN)
$(MAKE) kind-delete-cluster
$(MAKE) kind-create-cluster
$(MAKE) install-authorino-operator
Expand Down
File renamed without changes.
Loading
Loading