add redpanda to legion cluster

Deploy single-broker Redpanda in dedicated namespace with 20Gi storage,
1 CPU / 2Gi memory limits, and a one-shot topic init job for neuron.swarm,
neuron.ci, neuron.vcs, and neuron.webhooks with appropriate retention.
This commit is contained in:
Will Anderson
2026-04-24 12:38:55 -05:00
parent befbc006be
commit 92743b1efc
4 changed files with 79 additions and 17 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ spec:
path: servers/legion/k8s/redpanda
destination:
server: https://kubernetes.default.svc
namespace: platform
namespace: redpanda
syncPolicy:
automated:
prune: true
+14 -14
View File
@@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redpanda
namespace: platform
namespace: redpanda
labels:
app: redpanda
spec:
@@ -24,13 +24,13 @@ spec:
- redpanda
- start
- --smp=1
- --memory=512M
- --memory=1536M
- --reserve-memory=0M
- --overprovisioned
- --kafka-addr=INTERNAL://0.0.0.0:9092,EXTERNAL://0.0.0.0:9093
- --advertise-kafka-addr=INTERNAL://redpanda.platform.svc.cluster.local:9092,EXTERNAL://100.64.0.1:30094
- --advertise-kafka-addr=INTERNAL://redpanda.redpanda.svc.cluster.local:9092,EXTERNAL://100.64.0.1:30094
- --pandaproxy-addr=0.0.0.0:8082
- --advertise-pandaproxy-addr=redpanda.platform.svc.cluster.local:8082
- --advertise-pandaproxy-addr=redpanda.redpanda.svc.cluster.local:8082
ports:
- name: kafka-internal
containerPort: 9092
@@ -48,8 +48,8 @@ spec:
memory: 512Mi
cpu: 100m
limits:
memory: 1Gi
cpu: 500m
memory: 2Gi
cpu: "1"
readinessProbe:
exec:
command: ["rpk", "cluster", "info", "--brokers=localhost:9092"]
@@ -60,12 +60,12 @@ spec:
persistentVolumeClaim:
claimName: redpanda-data
---
# Internal ClusterIP — for in-cluster services (coordinator, CI jobs)
# Internal ClusterIP — for in-cluster services
apiVersion: v1
kind: Service
metadata:
name: redpanda
namespace: platform
namespace: redpanda
spec:
selector:
app: redpanda
@@ -81,12 +81,12 @@ spec:
targetPort: 8082
type: ClusterIP
---
# NodePort — for external access via Tailscale (100.64.0.1:30093)
# NodePort — external access via Tailscale (100.64.0.1:30093/30094)
apiVersion: v1
kind: Service
metadata:
name: redpanda-external
namespace: platform
namespace: redpanda
spec:
selector:
app: redpanda
@@ -101,7 +101,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: redpanda-console
namespace: platform
namespace: redpanda
labels:
app: redpanda-console
spec:
@@ -121,7 +121,7 @@ spec:
- containerPort: 8080
env:
- name: KAFKA_BROKERS
value: redpanda.platform.svc.cluster.local:9092
value: redpanda.redpanda.svc.cluster.local:9092
resources:
requests:
memory: 64Mi
@@ -134,7 +134,7 @@ apiVersion: v1
kind: Service
metadata:
name: redpanda-console
namespace: platform
namespace: redpanda
spec:
selector:
app: redpanda-console
@@ -147,7 +147,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: redpanda-console
namespace: platform
namespace: redpanda
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
cert-manager.io/cluster-issuer: letsencrypt-prod
+2 -2
View File
@@ -2,11 +2,11 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redpanda-data
namespace: platform
namespace: redpanda
spec:
storageClassName: local-path
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storage: 20Gi
@@ -0,0 +1,62 @@
---
# 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"