--- # One-time job to create Neuron Kafka topics in Redpanda. # Runs on startup; idempotent (rpk topic create is a no-op if topic already exists). # Argo CD will re-apply if deleted; ttlSecondsAfterFinished cleans it up automatically. apiVersion: batch/v1 kind: Job metadata: name: redpanda-topics-init namespace: redpanda spec: ttlSecondsAfterFinished: 300 template: spec: restartPolicy: OnFailure initContainers: - name: wait-for-redpanda image: docker.redpanda.com/redpandadata/redpanda:latest command: - sh - -c - | echo "Waiting for Redpanda to be ready..." until rpk cluster info --brokers=redpanda.redpanda.svc.cluster.local:9092 >/dev/null 2>&1; do echo "Redpanda not ready, retrying in 5s..." sleep 5 done echo "Redpanda is ready." containers: - name: create-topics image: docker.redpanda.com/redpandadata/redpanda:latest command: - sh - -c - | BROKER=redpanda.redpanda.svc.cluster.local:9092 echo "Creating neuron.swarm (retention 7 days)..." rpk topic create neuron.swarm \ --brokers "$BROKER" \ --topic-config retention.ms=604800000 \ || echo "neuron.swarm already exists, skipping" echo "Creating neuron.ci (retention 3 days)..." rpk topic create neuron.ci \ --brokers "$BROKER" \ --topic-config retention.ms=259200000 \ || echo "neuron.ci already exists, skipping" echo "Creating neuron.vcs (retention 3 days)..." rpk topic create neuron.vcs \ --brokers "$BROKER" \ --topic-config retention.ms=259200000 \ || echo "neuron.vcs already exists, skipping" echo "Creating neuron.webhooks (retention 1 day)..." rpk topic create neuron.webhooks \ --brokers "$BROKER" \ --topic-config retention.ms=86400000 \ || echo "neuron.webhooks already exists, skipping" echo "Topic init complete." rpk topic list --brokers "$BROKER"