diff --git a/Makefile b/Makefile index 5362a265..5686acfa 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,6 @@ 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 - PROTOC_BIN=$(PROJECT_PATH)/bin/protoc PROTOC_VERSION=21.1 UNAME_S := $(shell uname -s) @@ -54,13 +52,7 @@ update-protobufs: # cd vendor-protobufs/data-plane-api/envoy/type/ && \ # touch tmp && git merge-file ./matcher/v3/metadata.proto ./tmp ./metadata/v3/metadata.proto --own && rm tmp -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) +development: docker compose up stop-development: diff --git a/docker-compose.yaml b/docker-compose.yaml index e0265d69..462f972c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,11 +1,11 @@ --- -version: '2.2' services: envoy: image: envoyproxy/envoy:v1.20-latest depends_on: - limitador - upstream + - wasm-server command: - /usr/local/bin/envoy - --config-path @@ -25,6 +25,11 @@ services: volumes: - ./utils/docker-compose/envoy.yaml:/etc/envoy.yaml - ./target/wasm32-unknown-unknown/release/wasm_shim.wasm:/opt/kuadrant/wasm/wasm_shim.wasm + wasm-server: + build: + dockerfile: ./Dockerfile.server + expose: + - "80" limitador: image: quay.io/kuadrant/limitador:latest command: ["limitador-server", "-vvv", "/opt/kuadrant/limits/limits.yaml"] diff --git a/utils/docker-compose/envoy.yaml b/utils/docker-compose/envoy.yaml index e2b8b25d..3e2055a7 100644 --- a/utils/docker-compose/envoy.yaml +++ b/utils/docker-compose/envoy.yaml @@ -43,8 +43,12 @@ static_resources: vm_id: vm.sentinel.kuadrant_wasm runtime: envoy.wasm.runtime.v8 code: - local: - filename: /opt/kuadrant/wasm/wasm_shim.wasm + remote: + sha256: d5bd8b7a21e2369e130a9a2bd80345df30102b08d4fe070c1896a75769e7e2c0 + http_uri: + uri: http://wasm-server:80/plugin.wasm + cluster: wasm-server + timeout: 10s allow_precompiled: true configuration: "@type": "type.googleapis.com/google.protobuf.StringValue" @@ -259,6 +263,19 @@ static_resources: socket_address: address: limitador port_value: 8081 + - name: wasm-server + connect_timeout: 1s + type: STRICT_DNS + lb_policy: round_robin + load_assignment: + cluster_name: wasm-server + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: wasm-server + port_value: 80 admin: access_log_path: "/dev/null" address: