34 lines
1.1 KiB
YAML
34 lines
1.1 KiB
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: redpanda-topic-bootstrap
|
|
namespace: unrip
|
|
spec:
|
|
backoffLimit: 6
|
|
template:
|
|
spec:
|
|
restartPolicy: OnFailure
|
|
containers:
|
|
- name: bootstrap-topics
|
|
image: docker.redpanda.com/redpandadata/redpanda:v24.3.9
|
|
command: ["/bin/sh", "-lc"]
|
|
args:
|
|
- |
|
|
set -eu
|
|
BROKERS="redpanda.unrip.svc.cluster.local:9092"
|
|
TOPICS="raw.near_intents.quote norm.swap_demand cmd.execute_trade exec.trade_result"
|
|
|
|
echo "waiting for Redpanda at ${BROKERS}"
|
|
until rpk cluster info --brokers "$BROKERS" >/dev/null 2>&1; do
|
|
sleep 2
|
|
done
|
|
|
|
for topic in $TOPICS; do
|
|
if rpk topic describe "$topic" --brokers "$BROKERS" >/dev/null 2>&1; then
|
|
echo "topic already exists: $topic"
|
|
continue
|
|
fi
|
|
|
|
echo "creating topic: $topic"
|
|
rpk topic create --brokers "$BROKERS" --partitions 1 --replicas 1 "$topic"
|
|
done
|