oscerd opened a new pull request, #28175:
URL: https://github.com/apache/camel/pull/28175

   When the HTTP server (`camel.server.enabled=true`) and the HTTP management 
server (`camel.management.enabled=true`)
   have the same port (both default to 8080), `ManagementHttpServer.doInit()` 
does not start a server of its own: it adds
   the management endpoints to the HTTP server. The HTTP server keeps its own 
host, path, SSL and authentication, so the
   corresponding options of the management server were not applied, and nothing 
was logged.
   
   The management server now fails to start in that case, with a message that 
lists the settings and points to
   `camel.management.port`:
   
   - `camel.management.host` set to another host than the one of the HTTP server
   - `camel.management.path` set to another path than the one of the HTTP server
   - `camel.management.useGlobalSslContextParameters=true` when the HTTP server 
does not use the global SSL configuration
     (or `sslContextParameters` set on the management server)
   - authentication enabled on the management server
   
   Sharing the port without such settings keeps working as before, including 
authentication configured on the HTTP server
   for `/*`, which also covers the management endpoints.
   
   `camel run --mcp` binds the management server to `127.0.0.1` by default. 
When the management server shares the port of
   the HTTP server (for example with `--port` or `--openapi-ui`), that host was 
never applied (the `--mcp` help already
   says MCP is then served on the bind address of the HTTP server), and it 
would now fail the startup. `KameletMain`
   therefore applies that default only when the management server has a port of 
its own.
   
   ### Changes
   - `ManagementHttpServer`: check the management server settings before 
reusing the HTTP server.
   - `KameletMain`: the `--mcp` loopback default only applies to a management 
server with its own port.
   - Docs: a "Sharing the port with the management server" section in 
`platform-http-main.adoc`, and the
     `camel.management.port` description (regenerated metadata and catalog).
   - Upgrade guide notes: 4.24, plus 4.22.3 and 4.18.6 on `main` for the 
backports.
   
   ### Tests
   - `ManagementHttpServerSharedPortTest` (8 tests): sharing without settings 
serves the endpoints on the HTTP server; the
     same host and path are accepted; the authentication of the HTTP server 
applies; another host, another path, the global
     SSL configuration and authentication of the management server each fail 
the startup (these 4 pass without the fix,
     i.e. Camel started, and fail with it reverted); a dedicated port applies 
host, path and authentication.
   - `KameletMainMcpManagementHostTest` (4 tests): loopback default without 
HTTP server and with a dedicated port; the
     default host is kept on a shared port (fails with the fix reverted).
   - `camel-platform-http-main`: 43 tests, `camel-kamelet-main`: 60 tests, 0 
failures.
   - Full reactor `mvn clean install -DskipTests -DskipITs`: 707/707, only the 
expected regenerated files.
   
   Backports to `camel-4.22.x` and `camel-4.18.x` will follow once this is 
merged.
   
   JIRA: https://issues.apache.org/jira/browse/CAMEL-25462
   
   _Claude Code on behalf of Andrea Cosentino (@oscerd)_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to