Skip to content

feat: Simplify reservable port setup for the default router group - #1395

Open
ZPascal wants to merge 2 commits into
cloudfoundry:5.x.xfrom
ZPascal:router-group-ports-cleanup
Open

ZPascal wants to merge 2 commits into
cloudfoundry:5.x.xfrom
ZPascal:router-group-ports-cleanup

Conversation

@ZPascal

@ZPascal ZPascal commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1383, picking up Daniel's review comment: #1383 (comment)

The bean that sets the reservable port range on the default-tcp router group was a bit convoluted. This cleans it up:

  • It uses the shared RoutingClient bean now instead of building a second client with its own token provider.
  • It's no longer a Mono with initMethod = "block". It's a SmartInitializingSingleton that runs once the context is up.
  • cloudFoundryCleaner doesn't depend on it anymore. The initial cleanup now always runs, even when TCP routing isn't available.
  • If there is no default-tcp group, it fails with a message that points to SKIP_TCP_ROUTING_TESTS=true. It is used only to log a warning.
  • The skip check is a @ConditionalOnExpression on SKIP_TCP_ROUTING_TESTS.

Why is it implemented as a bean?

  • It does one setup job, and it has to run as a bean for ordering reasons.

I didn't use an ApplicationRunner like in the suggestion because the integration tests use @SpringJUnitConfig, not Spring Boot's application startup, so runners never get called. SmartInitializingSingleton gives the same timing.

Connected issue: #1394

Reuse the shared RoutingClient instead of building a second one, drop
the Mono bean with initMethod = "block", and stop making the cleaner
depend on it. Fail with a clear message if there is no default-tcp
router group.
@ZPascal
ZPascal force-pushed the router-group-ports-cleanup branch from a2c182e to 7e7bedb Compare October 31, 2026 09:36
@ZPascal ZPascal changed the title Simplify reservable port setup for the default router group feat: Simplify reservable port setup for the default router group Oct 31, 2026
Resolve the default-tcp group with flatMapIterable and blockFirst instead
of blocking on the whole response, which also avoids an NPE when the
response is empty.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant