Skip to content

Commit

Permalink
chore: more kubernetes
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Fontes <[email protected]>
  • Loading branch information
lxfontes committed Nov 14, 2024
1 parent a13f31f commit 926dd66
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 52 deletions.
17 changes: 17 additions & 0 deletions _examples/k8s/blaster-component-wadm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: blaster-component
annotations:
description: Blast Away
wasmcloud.dev/authors: Cosmonic
spec:
components:
- name: component
type: component
properties:
image: ttl.sh/da0244dc-90ee-4de3-8671-962a95c024d1:24h
traits:
- type: spreadscaler
properties:
replicas: 100
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@ spec:
replicas: 3
selector:
matchLabels:
app: wasmtime
app.kubernetes.io/name: wasmtime
template:
metadata:
labels:
app: wasmtime
app.kubernetes.io/name: wasmtime
spec:
nodeSelector:
cloud.google.com/compute-class: Balanced
containers:
- name: wrpc-wasmtime
- name: wasmtime
image: ghcr.io/cosmonic-labs/xk6-wrpc:main
imagePullPolicy: Always
resources:
requests:
memory: "11Gi"
cpu: "8"
limits:
cpu: "8"
env:
- name: RUST_LOG
value: error
Expand All @@ -24,7 +32,7 @@ spec:
- nats
- serve
- -n
- nats://nats.default.svc.cluster.local:4222
- nats://nats-headless.default.svc.cluster.local:4222
- --export
- wasmtime
- -g
Expand Down
10 changes: 6 additions & 4 deletions _examples/k8s/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ configurations:
namespace: k6

resources:
- testrun.yaml
- wasmtime.yaml
- wasmcloud-test.yaml
- wasmtime-test.yaml
- blaster-component-wasmtime.yaml

configMapGenerator:
- name: wrpc-example
- name: tests
files:
- test.js
- wasmcloud-test.js
- wasmtime-test.js
39 changes: 0 additions & 39 deletions _examples/k8s/test.js

This file was deleted.

40 changes: 40 additions & 0 deletions _examples/k8s/wasmcloud-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import wrpc from "k6/x/wrpc";

export const options = {
scenarios: {
blaster: {
executor: "constant-vus",
vus: 10,
duration: "15m",
exec: "wrpcBlaster",
},
// http: {
// executor: "constant-vus",
// vus: 10,
// duration: "15m",
// exec: "httpBlaster",
// },
},
};

let blaster = wrpc.blaster({
nats: {
url: "nats://nats-headless.default.svc.cluster.local:4222",
prefix: "default.blaster_component-component",
},
});

let http = wrpc.http({
nats: {
url: "nats://nats-headless.default.svc.cluster.local:4222",
prefix: "default.rust_hello_world-http_component",
},
});

export function wrpcBlaster() {
blaster.blast();
}

export function httpBlaster() {
http.get("http://localhost:8080/");
}
12 changes: 7 additions & 5 deletions _examples/k8s/testrun.yaml → _examples/k8s/wasmcloud-test.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
name: wrpc-example
name: wasmcloud
spec:
parallelism: 1
arguments: "--tag test-id=http-test -o experimental-opentelemetry"
parallelism: 5
# pod anti-affinity
separate: true
arguments: "--tag test-id=wasmcloud -o experimental-opentelemetry"
runner:
image: ghcr.io/cosmonic-labs/xk6-wrpc:main
imagePullPolicy: Always
Expand All @@ -17,5 +19,5 @@ spec:
value: "k6_"
script:
configMap:
name: wrpc-example
file: test.js
name: tests
file: wasmcloud-test.js
40 changes: 40 additions & 0 deletions _examples/k8s/wasmtime-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import wrpc from "k6/x/wrpc";

export const options = {
scenarios: {
blaster: {
executor: "constant-vus",
vus: 10,
duration: "15m",
exec: "wrpcBlaster",
},
// http: {
// executor: "constant-vus",
// vus: 10,
// duration: "15m",
// exec: "httpBlaster",
// },
},
};

let blaster = wrpc.blaster({
nats: {
url: "nats://nats-headless.default.svc.cluster.local:4222",
prefix: "wasmtime",
},
});

let http = wrpc.http({
nats: {
url: "nats://nats-headless.default.svc.cluster.local:4222",
prefix: "wasmtime",
},
});

export function wrpcBlaster() {
blaster.blast();
}

export function httpBlaster() {
http.get("http://localhost:8080/");
}
23 changes: 23 additions & 0 deletions _examples/k8s/wasmtime-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
name: wasmtime
spec:
parallelism: 5
# pod anti-affinity
separate: true
arguments: "--tag test-id=wasmtime -o experimental-opentelemetry"
runner:
image: ghcr.io/cosmonic-labs/xk6-wrpc:main
imagePullPolicy: Always
env:
- name: K6_OTEL_GRPC_EXPORTER_INSECURE
value: "true"
- name: K6_OTEL_GRPC_EXPORTER_ENDPOINT
value: "otel-collector-headless.default.svc.loadtesting:4317"
- name: K6_OTEL_METRIC_PREFIX
value: "k6_"
script:
configMap:
name: tests
file: wasmtime-test.js

0 comments on commit 926dd66

Please sign in to comment.