Skip to content

Commit 4e48900

Browse files
refactor: wasm32-wasi renamed to wasm32-wasip1 & rust to 1.78
proxy-wasm/proxy-wasm-rust-sdk#277 https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html Signed-off-by: Anton Engelhardt <[email protected]>
1 parent b9de9fb commit 4e48900

File tree

9 files changed

+57
-19
lines changed

9 files changed

+57
-19
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
run: rustc --version && cargo --version
4747

4848
- name: Clippy
49-
run: cargo clippy --release --all-targets --target=wasm32-wasi -- -D warnings
49+
run: cargo clippy --release --all-targets --target=wasm32-wasip1 -- -D warnings
5050

5151
fmt:
5252
runs-on: ubuntu-latest
@@ -110,7 +110,7 @@ jobs:
110110

111111
- name: Build wasm-oidc-plugin
112112
run: |
113-
cargo build --target wasm32-wasi --release
113+
cargo build --target wasm32-wasip1 --release
114114
115115
- name: Upload plugin as artifact
116116
uses: actions/upload-artifact@v4

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Build
3030
run: |
31-
cargo build --target wasm32-wasi --release
31+
cargo build --target wasm32-wasip1 --release
3232
3333
- name: Archive production artifacts
3434
uses: actions/upload-artifact@v4

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Clippy
4444
run: |
4545
rustc --version && cargo --version
46-
cargo clippy --release --all-targets --target=wasm32-wasi -- -D warnings
46+
cargo clippy --release --all-targets --target=wasm32-wasip1 -- -D warnings
4747
4848
fmt:
4949
runs-on: ubuntu-latest
@@ -107,7 +107,7 @@ jobs:
107107

108108
- name: Build wasm-oidc-plugin
109109
run: |
110-
cargo build --target wasm32-wasi --release
110+
cargo build --target wasm32-wasip1 --release
111111
112112
- name: Upload plugin as artifact
113113
uses: actions/upload-artifact@v4

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
FROM rust:1.75.0 AS builder
1+
FROM rust:1.78.0 AS builder
22

33
COPY src/ src/
44
COPY Cargo.toml Cargo.toml
55
COPY Cargo.lock Cargo.lock
66

7-
RUN rustup target add wasm32-wasi
7+
RUN rustup target add wasm32-wasip1
88

9-
RUN cargo build --target=wasm32-wasi --release
9+
RUN cargo build --target=wasm32-wasip1 --release
1010

1111
##################################################
1212

1313
FROM envoyproxy/envoy:v1.29-latest
1414

15-
COPY --from=builder /target/wasm32-wasi/release/wasm_oidc_plugin.wasm /etc/envoy/proxy-wasm-plugins/wasm_oidc_plugin.wasm
15+
COPY --from=builder /target/wasm32-wasip1/release/wasm_oidc_plugin.wasm /etc/envoy/proxy-wasm-plugins/wasm_oidc_plugin.wasm
1616

1717
CMD [ "envoy", "-c", "/etc/envoy/envoy.yaml" ]

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
build:
2-
cargo build --target wasm32-wasi --release
2+
cargo build --target wasm32-wasip1 --release
33
run:
4-
cargo build --target wasm32-wasi --release
4+
cargo build --target wasm32-wasip1 --release
55
docker-compose up
66
run-background:
7-
cargo build --target wasm32-wasi --release
7+
cargo build --target wasm32-wasip1 --release
88
docker-compose up -d
99
docker-image:
1010
docker buildx build --platform linux/amd64 -f Dockerfile -t antonengelhardt/wasm-oidc-plugin:latest .

README.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ apt install build-essential
3232
# Install Rustup
3333
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
3434
# Enable WASM compilation target
35-
cargo build --target wasm32-wasi --release
35+
cargo build --target wasm32-wasip1 --release
3636
```
3737

3838
## Run
@@ -50,7 +50,7 @@ make run
5050
1. **Building the plugin:**
5151

5252
```sh
53-
cargo build --target wasm32-wasi --release
53+
cargo build --target wasm32-wasip1 --release
5454
# or
5555
make build
5656
```
@@ -73,9 +73,10 @@ To deploy the plugin to production, the following steps are needed (either manua
7373

7474
1. Build the plugin
7575

76-
1.1 with `cargo build --target wasm32-wasi --release` - this can be done in a [initContainer](./k8s/deployment.yaml) (see [k8s](./k8s) folder) and then copy the binary to the path `/etc/envoy/proxy-wasm-plugins/` in the envoy container.
76+
1.1 with `cargo build --target wasm32-wasip1 --release` - this can be done in a [initContainer](./k8s/deployment.yaml) (see [k8s](./k8s) folder) and then copy the binary to the path `/etc/envoy/proxy-wasm-plugins/` in the envoy container.
77+
78+
1.2 by using the pre-built Docker image [antonengelhardt/wasm-oidc-plugin](https://hub.docker.com/r/antonengelhardt/wasm-oidc-plugin).
7779

78-
1.2 by using the pre-built Docker image [antonengelhardt/wasm-oidc-plugin](https://hub.docker.com/r/antonengelhardt/wasm-oidc-plugin).
7980
2. Run envoy as a container with the `envoy.yaml` file mounted through the [ConfigMap](./k8s/configmap.yml) as a volume.
8081
3. Set up [Service](./k8s/service.yml), [Certificate](./k8s/certificate-production.yml), [Ingress](./k8s/ingress.yml) to expose the Envoy to the internet.
8182

@@ -190,3 +191,40 @@ cargo-deny check advisories
190191
```
191192

192193
These commands are also run in the CI pipeline.
194+
195+
## FAQ
196+
197+
> My OpenID provider uses a different endpoint for the jwks_uri. How can I configure this?
198+
199+
Google does exactly that:
200+
201+
```json
202+
{
203+
"jwks_uri": "https://www.googleapis.com/oauth2/v3/certs"
204+
}
205+
```
206+
207+
You can add the endpoint in your `envoy.yaml`-file like this:
208+
209+
```yaml
210+
- name: google
211+
connect_timeout: 5s
212+
type: STRICT_DNS
213+
dns_lookup_family: V4_ONLY
214+
load_assignment:
215+
cluster_name: google
216+
endpoints:
217+
- lb_endpoints:
218+
- endpoint:
219+
address:
220+
socket_address:
221+
address: accounts.google.com
222+
port_value: 443
223+
- endpoint:
224+
address:
225+
socket_address:
226+
address: www.googleapis.com
227+
port_value: 443
228+
```
229+
230+
The rest should work fine.

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
- "10000:10000"
1010
volumes:
1111
- ./envoy.yaml:/etc/envoy/envoy.yaml
12-
- ./target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins
12+
- ./target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins
1313
networks:
1414
- envoymesh
1515
# Additional options:

k8s/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112

113113
- name: Build wasm-oidc-plugin
114114
run: |
115-
cargo build --target wasm32-wasi --release
115+
cargo build --target wasm32-wasip1 --release
116116
117117
- name: Upload plugin as artifact
118118
uses: actions/upload-artifact@v4

k8s/deployment-init-container.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spec:
3636
apk add git
3737
git clone -b main https://${GITHUB_PAT}@github.com/your-org/your-repo.git #! Change URL and branch
3838
cd your-repo #! Change directory
39-
cargo build --target wasm32-wasi --release
39+
cargo build --target wasm32-wasip1 --release
4040
cp target/wasm32-wasi/release/name_of_your_wasm_plugin.wasm /plugins/name_of_your_wasm_plugin.wasm #! Rename, if necessary
4141
4242
env:

0 commit comments

Comments
 (0)