fix(msk): report the broker's advertised hostname from GetBootstrapBrokers (#8404)

With Floci in a container and no bootstrap hostname configured,
GetBootstrapBrokers returned the broker container's IP, a bare address
where AWS returns broker hostnames. The broker's internal listener
already advertises <container-name>:9092, so a client that bootstrapped
from the IP was handed that name by the first Metadata response anyway.
GetBootstrapBrokers now returns <container-name>:9092.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-14 23:04:43 -04:00
1 parent 246d82ec57
commit 7a682dcd00
3 files changed
+17 -14

No files matched your search

@@ -466,8 +466,9 @@ class RedpandaManagerTest {
assertFalse(Files.exists(tempDir.resolve("msk").resolve("test-cluster")),
"container mode must not create host directories from inside the emulator container");
assertEquals("172.18.0.5:9092", cluster.getBootstrapBrokers(),
"without a bootstrap hostname, GetBootstrapBrokers keeps the Docker-network address");
assertEquals("floci-aws-msk-abc123:9092", cluster.getBootstrapBrokers(),
"without a bootstrap hostname, GetBootstrapBrokers names the internal listener the way the "
+ "broker advertises it, not by the container IP");
}
@Test
@@ -513,7 +514,7 @@ class RedpandaManagerTest {
int flagIndex = spec.cmd().indexOf("--advertise-kafka-addr");
assertEquals("internal://floci-aws-msk-abc123:9092,host://localhost:9305",
spec.cmd().get(flagIndex + 1));
assertEquals("172.18.0.8:9092", cluster.getBootstrapBrokers());
assertEquals("floci-aws-msk-abc123:9092", cluster.getBootstrapBrokers());
}
@Test