feat(core): namespace a host native binary's child containers by port (#5800)

A native binary on the host shares the Docker daemon with any Floci image,
or a second binary, running beside it. With no resource namespace they
name child containers and volumes alike, so creating RDS instance mydb in
one removes the other's container before starting its own.

A native run outside a container now defaults floci.docker.resource-namespace
to host-<floci.port>, through the same ordinal-260 HostDefaultsConfigSource,
so an explicit namespace still wins and the image keeps an empty one.

Refs #5767

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-16 09:11:49 -04:00
1 parent e494e1aecf
commit cb378afd41
2 files changed
+21 -3

No files matched your search

@@ -57,6 +57,16 @@ class HostDefaultsConfigSourceTest {
equalTo("/mnt/floci"));
}
@Test
void nativeHostRunNamespacesChildResourcesByPort() {
HostDefaultsConfigSource source = new HostDefaultsConfigSource(true);
assertThat(source.getValue(HostDefaultsConfigSource.RESOURCE_NAMESPACE), equalTo("host-${floci.port}"));
SmallRyeConfig config = configWith(source,
new PropertiesConfigSource(Map.of("floci.port", "4597"), "env", 300));
assertThat(config.getValue(HostDefaultsConfigSource.RESOURCE_NAMESPACE, String.class), equalTo("host-4597"));
}
@Test
void ordinalOverridesOnlyTheBundledYaml() {
// classpath application.yml is 255, config/application.yml in the working directory 265.