-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spit deployment files for alternative build methods
Signed-off-by: Anton Engelhardt <[email protected]>
- Loading branch information
1 parent
a182597
commit 1a21687
Showing
2 changed files
with
152 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Alternative 1: Build Plugin in a initContainer | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
|
||
metadata: | ||
name: example-app | ||
namespace: example-namespace | ||
labels: | ||
app: example-app | ||
|
||
spec: | ||
|
||
selector: | ||
matchLabels: | ||
app: example-envoy | ||
replicas: 1 | ||
|
||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
|
||
template: | ||
metadata: | ||
labels: | ||
app: example-app | ||
|
||
spec: | ||
initContainers: | ||
- name: build-plugin | ||
image: antonengelhardt/rust-docker-tools:latest | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
apk add git | ||
git clone https://${GITHUB_PAT}@github.com/your-org/your-repo.git #! Change URL | ||
cd your-repo #! Change directory | ||
cargo build --target wasm32-wasi --release | ||
cp target/wasm32-wasi/release/name_of_your_wasm_plugin.wasm /plugins/name_of_your_wasm_plugin.wasm #! Rename, if necessary | ||
env: | ||
- name: GITHUB_PAT #? if your repo is private, you need to provide a github personal access token in a secret | ||
valueFrom: | ||
secretKeyRef: | ||
name: github-pat | ||
key: password | ||
|
||
volumeMounts: | ||
- name: plugins | ||
mountPath: /plugins | ||
|
||
containers: | ||
- name: envoy | ||
image: envoyproxy/envoy:v1.24-latest | ||
|
||
resources: | ||
requests: | ||
cpu: 1000m | ||
memory: 1000Mi | ||
limits: | ||
cpu: 1000m | ||
memory: 1000Mi | ||
|
||
volumeMounts: | ||
- name: plugins | ||
mountPath: /etc/envoy/proxy-wasm-plugins | ||
- name: envoy-config | ||
mountPath: /etc/envoy | ||
|
||
ports: | ||
- containerPort: 10000 | ||
name: http | ||
protocol: TCP | ||
|
||
command: ["envoy", "-c", "/etc/envoy/envoy.yaml", "--concurrency", "1"] | ||
|
||
volumes: | ||
- name: plugins | ||
emptyDir: {} | ||
- name: envoy-config | ||
configMap: | ||
name: example-envoy-config | ||
items: | ||
- key: envoy.yaml | ||
path: envoy.yaml | ||
|
||
restartPolicy: Always |
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,62 @@ | ||
# Alternative 2: Use pre-built [Docker-Image](https://hub.docker.com/r/antonengelhardt/wasm-oidc-plugin) from Docker Hub | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
|
||
metadata: | ||
name: example-app | ||
namespace: example-namespace | ||
labels: | ||
app: example-app | ||
|
||
spec: | ||
|
||
selector: | ||
matchLabels: | ||
app: example-envoy | ||
replicas: 1 | ||
|
||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
|
||
template: | ||
metadata: | ||
labels: | ||
app: example-app | ||
|
||
spec: | ||
containers: | ||
- name: envoy | ||
image: antonengelhardt/wasm-oidc-plugin:latest | ||
|
||
resources: | ||
requests: | ||
cpu: 1000m | ||
memory: 1000Mi | ||
limits: | ||
cpu: 1000m | ||
memory: 1000Mi | ||
|
||
volumeMounts: | ||
- name: envoy-config | ||
mountPath: /etc/envoy | ||
|
||
ports: | ||
- containerPort: 10000 | ||
name: http | ||
protocol: TCP | ||
|
||
command: ["envoy", "-c", "/etc/envoy/envoy.yaml", "--concurrency", "1"] | ||
|
||
volumes: | ||
- name: envoy-config | ||
configMap: | ||
name: example-envoy-config | ||
items: | ||
- key: envoy.yaml | ||
path: envoy.yaml | ||
|
||
restartPolicy: Always |