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:
@@ -11,7 +11,7 @@ spec:
|
|||||||
path: servers/legion/k8s/redpanda
|
path: servers/legion/k8s/redpanda
|
||||||
destination:
|
destination:
|
||||||
server: https://kubernetes.default.svc
|
server: https://kubernetes.default.svc
|
||||||
namespace: platform
|
namespace: redpanda
|
||||||
syncPolicy:
|
syncPolicy:
|
||||||
automated:
|
automated:
|
||||||
prune: true
|
prune: true
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ apiVersion: apps/v1
|
|||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: redpanda
|
name: redpanda
|
||||||
namespace: platform
|
namespace: redpanda
|
||||||
labels:
|
labels:
|
||||||
app: redpanda
|
app: redpanda
|
||||||
spec:
|
spec:
|
||||||
@@ -24,13 +24,13 @@ spec:
|
|||||||
- redpanda
|
- redpanda
|
||||||
- start
|
- start
|
||||||
- --smp=1
|
- --smp=1
|
||||||
- --memory=512M
|
- --memory=1536M
|
||||||
- --reserve-memory=0M
|
- --reserve-memory=0M
|
||||||
- --overprovisioned
|
- --overprovisioned
|
||||||
- --kafka-addr=INTERNAL://0.0.0.0:9092,EXTERNAL://0.0.0.0:9093
|
- --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
|
- --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:
|
ports:
|
||||||
- name: kafka-internal
|
- name: kafka-internal
|
||||||
containerPort: 9092
|
containerPort: 9092
|
||||||
@@ -48,8 +48,8 @@ spec:
|
|||||||
memory: 512Mi
|
memory: 512Mi
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
limits:
|
limits:
|
||||||
memory: 1Gi
|
memory: 2Gi
|
||||||
cpu: 500m
|
cpu: "1"
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
exec:
|
exec:
|
||||||
command: ["rpk", "cluster", "info", "--brokers=localhost:9092"]
|
command: ["rpk", "cluster", "info", "--brokers=localhost:9092"]
|
||||||
@@ -60,12 +60,12 @@ spec:
|
|||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: redpanda-data
|
claimName: redpanda-data
|
||||||
---
|
---
|
||||||
# Internal ClusterIP — for in-cluster services (coordinator, CI jobs)
|
# Internal ClusterIP — for in-cluster services
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: redpanda
|
name: redpanda
|
||||||
namespace: platform
|
namespace: redpanda
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: redpanda
|
app: redpanda
|
||||||
@@ -81,12 +81,12 @@ spec:
|
|||||||
targetPort: 8082
|
targetPort: 8082
|
||||||
type: ClusterIP
|
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
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: redpanda-external
|
name: redpanda-external
|
||||||
namespace: platform
|
namespace: redpanda
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: redpanda
|
app: redpanda
|
||||||
@@ -101,7 +101,7 @@ apiVersion: apps/v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: redpanda-console
|
name: redpanda-console
|
||||||
namespace: platform
|
namespace: redpanda
|
||||||
labels:
|
labels:
|
||||||
app: redpanda-console
|
app: redpanda-console
|
||||||
spec:
|
spec:
|
||||||
@@ -121,7 +121,7 @@ spec:
|
|||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
env:
|
env:
|
||||||
- name: KAFKA_BROKERS
|
- name: KAFKA_BROKERS
|
||||||
value: redpanda.platform.svc.cluster.local:9092
|
value: redpanda.redpanda.svc.cluster.local:9092
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
memory: 64Mi
|
memory: 64Mi
|
||||||
@@ -134,7 +134,7 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: redpanda-console
|
name: redpanda-console
|
||||||
namespace: platform
|
namespace: redpanda
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: redpanda-console
|
app: redpanda-console
|
||||||
@@ -147,7 +147,7 @@ apiVersion: networking.k8s.io/v1
|
|||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: redpanda-console
|
name: redpanda-console
|
||||||
namespace: platform
|
namespace: redpanda
|
||||||
annotations:
|
annotations:
|
||||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ apiVersion: v1
|
|||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: redpanda-data
|
name: redpanda-data
|
||||||
namespace: platform
|
namespace: redpanda
|
||||||
spec:
|
spec:
|
||||||
storageClassName: local-path
|
storageClassName: local-path
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
requests:
|
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"
|
||||||
Reference in New Issue
Block a user