Skip to content

Commit f47f5b6

Browse files
committed
rmq
1 parent 1a1ee4d commit f47f5b6

8 files changed

Lines changed: 189 additions & 75 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,31 @@ task mysql:query:source
202202
task mysql:query:branch SCENARIO=env-val
203203
```
204204

205+
### RabbitMQ Queue Splitting
206+
207+
```bash
208+
# Fresh cluster with RabbitMQ from scratch
209+
task test:rmq:clean
210+
211+
# Open the RabbitMQ management UI (http://localhost:15672)
212+
task rmq:management
213+
214+
# Show RabbitMQ connection credentials
215+
task rmq:credentials
216+
217+
# List mirrord temp queues left in the broker
218+
task rmq:queues:mirrord
219+
220+
# Delete all mirrord temp queues from the broker
221+
task rmq:queues:mirrord:delete
222+
223+
# Publish a test message with a tenant header
224+
task rmq:send QUEUE="orders" TENANT="a" MESSAGE="hello"
225+
226+
# Run the e2e tests (from the operator/ directory)
227+
cargo test -p tests -- --ignored rmq_queue_splitting --nocapture
228+
```
229+
205230
### SQS/Kafka
206231

207232
```bash

Taskfile.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ includes:
2727
multicluster:
2828
taskfile: ./tasks/Taskfile.multicluster.yml
2929
dir: ./tasks
30+
rmq:
31+
taskfile: ./tasks/Taskfile.rmq.yml
32+
dir: ./tasks
3033
eks:
3134
taskfile: ./tasks/Taskfile.eks.yml
3235
dir: ./tasks
@@ -35,7 +38,7 @@ vars:
3538
ROOT_DIR:
3639
sh: pwd
3740
OPERATOR_DIR: '{{.OPERATOR_DIR | default (print .ROOT_DIR "/../operator")}}'
38-
CHARTS_DIR: '{{.CHARTS_DIR | default (print .ROOT_DIR "/../charts/mirrord-operator")}}'
41+
CHARTS_DIR: '{{.CHARTS_DIR | default (print .ROOT_DIR "/../operator/charts/mirrord-operator")}}'
3942
SCRIPTS_DIR: '{{.SCRIPTS_DIR | default (print .ROOT_DIR "/scripts")}}'
4043
MIRRORD_DIR: '{{.MIRRORD_DIR | default (print .ROOT_DIR "/../mirrord")}}'
4144
OPERATOR_IMAGE: '{{.OPERATOR_IMAGE | default "mirrord-operator:custom"}}'
@@ -128,6 +131,15 @@ tasks:
128131
operator
129132
- task: operator:image:load
130133

134+
build:mirrord:agent:
135+
desc: Build mirrord agent image and load into minikube
136+
vars:
137+
AGENT_IMAGE: '{{.AGENT_IMAGE | default "test"}}'
138+
cmds:
139+
- cd {{.MIRRORD_DIR}} && {{.CONTAINER_RUNTIME}} build -f mirrord/agent/Dockerfile -t {{.AGENT_IMAGE}} .
140+
- task: mirrord:agent:image:load
141+
vars: { AGENT_IMAGE: "{{.AGENT_IMAGE}}" }
142+
131143
build:mirrord:agent:gcs:
132144
desc: Build mirrord agent with GCS sccache
133145
vars:
@@ -687,6 +699,30 @@ tasks:
687699
- task: operator:install
688700
- task: sqs:deploy:aws
689701

702+
test:rmq:
703+
desc: "Deploy RabbitMQ Cluster Operator + cluster and install operator"
704+
deps: [operator:install]
705+
cmds:
706+
- task: rmq:deploy
707+
708+
test:rmq:clean:
709+
desc: "Clean cluster and deploy RabbitMQ from scratch"
710+
cmds:
711+
- task: cluster:delete
712+
- task: cluster:create
713+
- task: build:mirrord:agent
714+
- task: operator:install
715+
- task: rmq:deploy
716+
717+
test:rmq:clean:nobuild:
718+
desc: "Clean cluster and deploy RabbitMQ (skip operator build)"
719+
cmds:
720+
- task: cluster:delete
721+
- task: cluster:create
722+
- task: build:mirrord:agent
723+
- task: operator:install:nobuild
724+
- task: rmq:deploy
725+
690726
test:kafka:
691727
desc: "Run Kafka test"
692728
deps: [build:app:kafka, operator:install]

k8s/overlays/multicluster-sqs/localstack-single.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
spec:
1919
containers:
2020
- name: localstack
21-
image: localstack/localstack:latest
21+
image: localstack/localstack:4.14.0
2222
env:
2323
- name: SERVICES
2424
value: "sqs"

k8s/overlays/multicluster-sqs/localstack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
spec:
1616
containers:
1717
- name: localstack
18-
image: localstack/localstack:latest
18+
image: localstack/localstack:4.14.0
1919
env:
2020
- name: SERVICES
2121
value: "sqs"

k8s/overlays/sqs-localstack/localstack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
spec:
1616
containers:
1717
- name: localstack
18-
image: localstack/localstack:latest
18+
image: localstack/localstack:4.14.0
1919
env:
2020
- name: SERVICES
2121
value: "sqs"

operator-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
operator:
22
image: mirrord-operator
33
sqsSplitting: true
4+
rmqSplitting: true
45
kafkaSplitting: true
56
mysqlBranching: true
67
pgBranching: true

tasks/Taskfile.multicluster.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,29 @@ tasks:
16341634
fi
16351635
- echo "All sessions cleaned up"
16361636

1637+
test:cleanup:resources:
1638+
desc: Delete leftover test deployments, services, and copy pods across all clusters
1639+
cmds:
1640+
- |
1641+
for ctx in {{.PRIMARY_CLUSTER}} {{.REMOTE_CLUSTER_1}}; do
1642+
echo "=== Cleaning $ctx ==="
1643+
kubectl --context $ctx delete deployments,services -n {{.MC_NAMESPACE}} -l mirrord-e2e-test-resource=true --ignore-not-found=true --wait=false
1644+
kubectl --context $ctx delete pods -n {{.MC_NAMESPACE}} -l operator.metalbear.co/resource-type=copy-target --ignore-not-found=true --wait=false
1645+
done
1646+
- |
1647+
if [ "{{.NUM_CLUSTERS}}" = "3" ]; then
1648+
echo "=== Cleaning {{.REMOTE_CLUSTER_2}} ==="
1649+
kubectl --context {{.REMOTE_CLUSTER_2}} delete deployments,services -n {{.MC_NAMESPACE}} -l mirrord-e2e-test-resource=true --ignore-not-found=true --wait=false
1650+
kubectl --context {{.REMOTE_CLUSTER_2}} delete pods -n {{.MC_NAMESPACE}} -l operator.metalbear.co/resource-type=copy-target --ignore-not-found=true --wait=false
1651+
fi
1652+
- echo "All leftover test resources cleaned up"
1653+
1654+
test:cleanup:all:
1655+
desc: Clean up all test sessions and leftover resources
1656+
cmds:
1657+
- task: test:cleanup:sessions
1658+
- task: test:cleanup:resources
1659+
16371660
test:full:
16381661
desc: Run full multi-cluster test setup
16391662
cmds:

0 commit comments

Comments
 (0)