-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v17] Add multi-port support for TCP apps (#49711)
* Add Ports field to app spec * Add Ports to AppSpecV3 * Validate ports of api/types.AppV3 * Add Ports to lib/config and lib/service/servicecfg * lib/config TestApps: Improve error messages * lib/service: Convert servicecfg.PortRange to types.PortRange * Add multi-port TCP apps to config and tctl tests * Rename Ports to TCPPorts * Change port fields to uint16 where possible * Update comments for Port and EndPort * Extract port range validation to api/utils/net * Replace custom check type with require.ErrorAssertionFunc * Add `TargetPort` to `RouteToApp` & use it to route connections to multi-port TCP apps * Add TargetPort to RouteToApp and AppMetadata proto messages * Pass TargetPort during cert generation * Refactor Pack.makeTLSConfig to accept struct This will make it easier to add targetPort to it. * Add labels to UUIDs used by appaccess test pack app servers This makes them easier to distinguish when routing doesn't work as expected. * Refactor Pack.CreateAppSession to accept a struct * TestTCP: Create app session within test If we kept the old code, we'd need to manually create a session for each target port, which would create a lot of duplication. * Prepare integration test fixtures for multi-port tests * Add api/utils/net.IsPortInRange * Use TargetPort when routing TCP connections * Inline dialMultiPortTCPApp, centralize logic * Check target port when connecting to single-port app * Reorder check in IsPortInRange * Use int instead of uint16 * Extract picking dialTarget to separate function * Improve err msg for single-port apps when targetPort != uriPort * Fix unnecessary conversion to int * Pass port from VNet to local proxy * Prepare app specs in tests for specifying TCP ports * Refactor logging in lib/vnet/app_resolver.go Use libutils.NewPackageLogger, call it log instead of slog which makes it harder to use the imported default slog logger instead of the one from a struct. Move creation of logger within TCPAppResolver.resolveTCPHandlerForCluster * Pass port from VNet to local proxy * Don't create another package logger * Don't pass logger to newTCPAppHandler * Fix typo in comment * Explicitly pass port to dialHost * Convert multi-line definitions of simple appSpecs to single-line * Add TODO comment about validating local port * Empty commit to trigger CI * ConvertAuditEvent: Set SessionStartEvent.App.IsMultiPort
- Loading branch information
Showing
40 changed files
with
8,866 additions
and
6,825 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.