Skip to content

Commit

Permalink
try building a shrinked version of the tcp metadata module
Browse files Browse the repository at this point in the history
  • Loading branch information
bonifaido committed Jun 21, 2023
1 parent 72abad6 commit 7a6dd2a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/acceptance-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

- name: Build TCP metadata exchange filter
run: |
make tcp-metadata-exchange-filter
make tcp-metadata-exchange-filter-shrinked
- name: Deploy to kind cluster (istio-operator)
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Build TCP metadata exchange filter
run: |
make tcp-metadata-exchange-filter
make tcp-metadata-exchange-filter-shrinked
- name: Run unit tests
run: make test
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ tcp-metadata-exchange-filter: ## build the tcp-metadata-exchange-filter
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown --release
cp target/wasm32-unknown-unknown/release/wasm_tcp_metadata.wasm pkg/istio/filters/tcp-metadata-exchange-filter.wasm

.PHONY: tcp-metadata-exchange-filter-shrinked
tcp-metadata-exchange-filter-shrinked: ## build the smaller version of tcp-metadata-exchange-filter
rustup target add wasm32-unknown-unknown
cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort -j1 --release --target wasm32-unknown-unknown
cp target/wasm32-unknown-unknown/release/wasm_tcp_metadata.wasm pkg/istio/filters/tcp-metadata-exchange-filter.wasm
10 changes: 8 additions & 2 deletions experimental/wasm-tcp-metadata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
Optimalize the binary size of the created module even further by running:

```bash
# Install wasm-opt
cargo install wasm-opt --locked
```

```bash
# Optimize for size
wasm-opt -Os target/wasm32-unknown-unknown/release/wasm_tcp_metadata.wasm -o target/wasm32-unknown-unknown/release/wasm_tcp_metadata.wasm
```

Expand All @@ -31,7 +37,7 @@ git clone git@github.com:istio-ecosystem/wasm-extensions.git
cd wasm-extensions
```

Now start a Bazel container (use the specified image version, other versions simply don't work on Mac, and ARM:
Now start a Bazel container (use the specified image version, other versions simply don't work on Mac, and ARM):

```bash
docker run -v $PWD:/tmp/work -w /tmp/work --rm -it --entrypoint bash gcr.io/bazel-public/bazel:5.4.0
Expand All @@ -44,4 +50,4 @@ build '//extensions/stats:stats.wasm' # This takes some time if you are on an AR
cp bazel-bin/extensions/stats/stats.wasm .
```

You can find the stats.wasm now in your `wasm-extensions` working directory.
You can find the `stats.wasm` now in your `wasm-extensions` working directory.

0 comments on commit 7a6dd2a

Please sign in to comment.