Fix DNS subject (fixes #265)
Previously, all DNS records for a given cluster went to the same subject. The cli fetches DNS records using DeliverPolicy::LastPerSubject, so it only gets the last message sent to a subject (so one per cluster). This fixes the issue by adding the backend ID to the subject.
Leaving this as a draft for now because this changes the NATS API between the drone and controller and I haven't thought through a zero-downtime migration path as we try to do for NATS API changes.
Currently, migration requires:
- Re-installing the CLI (
cargo install --path=cliin root of the repo) - Deleting the old stream (
nats stream delete dns_record) - Re-building and running the controller and drone (
docker compose buildfollowed bydocker compose up)
Stepped deploy approach:
- Deploy controller. The
dns_record_tmpstream will be created, but messages published will appear on both the newdns_record_tmpanddns_recordstreams. - Drain and redeploy drones. Drones will produce new messages which appear only in the
dns_record_tmpstream, but this is fine because consumers ofdns_recordhave been removed. - Delete the
dns_recordstream in NATS. - In a follow-up PR, change
dns_record_tmpback todns_record. - Deploy.
- Delete the
dns_record_tmpstream in NATS.
I've decided to roll this into the ongoing state machine refactoring work, so I'm going to close this PR.
I've decided to roll this into the ongoing state machine refactoring work, so I'm going to close this PR.