Skip to content

Instantly share code, notes, and snippets.

@codelipenghui
Created January 30, 2025 02:10
Show Gist options
  • Save codelipenghui/06bada89381fb77a7862e1b4c1d8963d to your computer and use it in GitHub Desktop.
Save codelipenghui/06bada89381fb77a7862e1b4c1d8963d to your computer and use it in GitHub Desktop.
The OpenMessaging Benchmark workers for consumers with zone_id
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: benchmark-worker-consumer
namespace: max
spec:
replicas: 6
selector:
matchLabels:
app: benchmark
component: worker-consumer
serviceName: benchmark-worker-headless
template:
metadata:
labels:
app: benchmark
component: worker-consumer
spec:
affinity:
podAffinity: {}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: benchmark
component: worker-consumer
topologyKey: failure-domain.beta.kubernetes.io/zone
- labelSelector:
matchLabels:
cloud.streamnative.io/app: pulsar
cloud.streamnative.io/component: broker
topologyKey: kubernetes.io/hostname
containers:
- args:
- |
apk update && apk add curl jq
export TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600");
export ZONE_ID=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/placement/availability-zone-id);
export HEAP_OPTS="-Xms20G -Xmx20G -Dzone.id=${ZONE_ID}"
bin/benchmark-worker
command:
- sh
- -c
image: streamnative/benchmark:base_image
imagePullPolicy: Always
name: benchmark-worker-consumer
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8081
protocol: TCP
resources:
limits:
cpu: "12"
memory: 24Gi
requests:
cpu: "12"
memory: 24Gi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment