Skip to content

Commit

Permalink
restructure dir
Browse files Browse the repository at this point in the history
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
  • Loading branch information
rajatjindal committed Apr 22, 2024
1 parent e9bb770 commit aade889
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/workloads-common/redis-conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-redis-config
data:
redis-config: |
maxmemory 2mb
maxmemory-policy allkeys-lru
47 changes: 47 additions & 0 deletions tests/workloads-common/redis-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: v1
kind: Pod
metadata:
name: redis
labels:
name: redis
spec:
containers:
- name: redis
image: redis:5.0.4
command:
- redis-server
- "/redis-master/redis.conf"
env:
- name: MASTER
value: "true"
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /redis-master
name: config
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: test-redis-config
items:
- key: redis-config
path: redis.conf
---
kind: Service
apiVersion: v1
metadata:
name: redis-service
spec:
selector:
name: redis
ports:
- protocol: TCP
port: 6379
targetPort: 6379
5 changes: 5 additions & 0 deletions tests/workloads-common/runtime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: wasmtime-spin
handler: spin
11 changes: 11 additions & 0 deletions tests/workloads-common/spin-runtime-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
data:
runtime-config.toml: "# This defines a new store named user_data\n[key_value_store.foo]\ntype
= \"spin\" \npath = \"user_data.db\""
kind: ConfigMap
metadata:
creationTimestamp: "2023-11-14T00:41:01Z"
name: spin-runtime-config
namespace: default
resourceVersion: "4453"
uid: 10dd6b0d-cf71-4ddc-abf8-44853f53436e
212 changes: 212 additions & 0 deletions tests/workloads-spin-registry-push/workload-spin-registry-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: wasm-spin
spec:
replicas: 1
selector:
matchLabels:
app: wasm-spin
template:
metadata:
labels:
app: wasm-spin
spec:
runtimeClassName: wasmtime-spin
containers:
- name: testwasm
image: test-registry:5000/spin-registry-push/spin-hello-world:latest
imagePullPolicy: IfNotPresent
command: ["/"]
resources: # limit the resources to 128Mi of memory and 100m of CPU
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
name: wasm-spin
spec:
ports:
- protocol: TCP
port: 80
targetPort: 80
selector:
app: wasm-spin
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: spin-keyvalue
spec:
replicas: 1
selector:
matchLabels:
app: spin-keyvalue
template:
metadata:
labels:
app: spin-keyvalue
spec:
runtimeClassName: wasmtime-spin
containers:
- name: keyvalue
image: test-registry:5000/spin-registry-push/spin-keyvalue:latest
command: ["/"]
imagePullPolicy: IfNotPresent
volumeMounts:
- name: config-volume
mountPath: /runtime-config.toml
subPath: runtime-config.toml
readOnly: true
volumes:
- name: config-volume
configMap:
name: spin-runtime-config
---
apiVersion: v1
kind: Service
metadata:
name: spin-keyvalue
spec:
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: 80
selector:
app: spin-keyvalue
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: spin-outbound-redis
spec:
replicas: 1
selector:
matchLabels:
app: spin-outbound-redis
template:
metadata:
labels:
app: spin-outbound-redis
spec:
runtimeClassName: wasmtime-spin
containers:
- name: outbound-redis
image: test-registry:5000/spin-registry-push/spin-outbound-redis:latest
command: ["/"]
imagePullPolicy: IfNotPresent
env:
- name: SPIN_VARIABLE_REDIS_ADDRESS
value: redis://redis-service.default.svc.cluster.local:6379
- name: SPIN_VARIABLE_REDIS_CHANNEL
value: test
---
apiVersion: v1
kind: Service
metadata:
name: spin-outbound-redis
spec:
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: 80
selector:
app: spin-outbound-redis
---
# Middleware
# Strip prefix /spin
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: strip-prefix
spec:
stripPrefix:
forceSlash: false
prefixes:
- /spin
- /outboundredis
- /keyvalue
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wasm-ingress
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
traefik.ingress.kubernetes.io/router.middlewares: default-strip-prefix@kubernetescrd
spec:
ingressClassName: traefik
rules:
- http:
paths:
- path: /spin
pathType: Prefix
backend:
service:
name: wasm-spin
port:
number: 80
- path: /keyvalue
pathType: Prefix
backend:
service:
name: spin-keyvalue
port:
number: 80
- path: /outboundredis
pathType: Prefix
backend:
service:
name: spin-outbound-redis
port:
number: 80
- path: /multi-trigger-app
pathType: Prefix
backend:
service:
name: spin-multi-trigger-app
port:
number: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: spin-multi-trigger-app
spec:
replicas: 1
selector:
matchLabels:
app: spin-multi-trigger-app
template:
metadata:
labels:
app: spin-multi-trigger-app
spec:
runtimeClassName: wasmtime-spin
containers:
- name: spin-multi-trigger-app
image: test-registry:5000/spin-registry-push/spin-multi-trigger-app:latest
imagePullPolicy: IfNotPresent
command: ["/"]
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: spin-multi-trigger-app
spec:
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: 80
selector:
app: spin-multi-trigger-app

0 comments on commit aade889

Please sign in to comment.