-
-
Notifications
You must be signed in to change notification settings - Fork 563
feat: add port information to workload list output #3986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/v2
Are you sure you want to change the base?
feat: add port information to workload list output #3986
Conversation
thallgren
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a useful addition.
8ac45de to
f823d09
Compare
thallgren
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just some minor nits.
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment, or this will be closed in 14 days. |
…oads - Introduced WorkloadPortInfo message in connector.proto and manager.proto to encapsulate details about ports exposed by a workload's container, including name, port number, and protocol (TCP/UDP). - Updated WorkloadInfo message to include a repeated field for WorkloadPortInfo, allowing for multiple ports to be specified for each workload. - Adjusted the corresponding generated Go files to reflect these changes in the protobuf definitions.
011b5f3 to
fd05b03
Compare
The protobuf generated file was out of sync, causing build failures with undefined references to ConnectInfo_ErrType, InterceptResult, common.InterceptError, and common.Result. Fixed by running make generate-clean && make generate
The documentation was previously generated on macOS which used $HOME/Library/Application Support paths. Changed to use the standard Linux-style $HOME/.config paths for consistency.
…rect macOS path - Removed personal documentation files that were accidentally committed - Restored docs/reference/config.md to correct macOS path format (macOS should use Library/Application Support, not .config)
Add Port Information to Workload List Output
Summary
This PR adds port information to the
telepresence listcommand output, allowing developers to see which ports are available on interceptable workloads without needing to usekubectl. This is particularly useful for VS Code extensions and other tooling that need to display port information to users.Problem Statement
Previously, when running
telepresence list, users could see workload names, namespaces, and intercept status, but had no visibility into which ports were exposed by each workload. To discover ports, users had to run separatekubectlcommands, which:Solution
The feature now includes port information in the list output by:
Changes
Protocol Definitions
WorkloadPortInfomessage with fields:container_port_name- Symbolic name of the container port (mandatory field)container_port- Numeric container port number (mandatory, always present)protocol- Protocol used by the port (TCP or UDP)service_port_name- Symbolic name of the service port (may be empty for headless services or replacements)service_port- Numeric service port number (may be 0 for headless services or replacements)manager.WorkloadPortInfodirectly (no duplicate definition)Traffic Manager
extractPortsFromSidecar()- Extracts both container and service port information from sidecar configurationextractPortsForWorkload()- Generates sidecar and extracts ports using service discoveryrpcWorkload()- Includes port information in WorkloadInfotypes.PortAndProtofor protocol-aware deduplication (handles TCP/UDP on same port)k8stypesto avoid conflict withtypespackageClient
manager.WorkloadPortInfodirectly (no type conversion needed)Tests
cmd/traffic/cmd/manager/state/workload_info_watcher_test.go: Created with 13 comprehensive unit tests
integration_test/list_watch_test.go: Added 4 integration tests
Test_ListWithPorts()- Verifies ports appear in JSON output with required fieldsTest_ListWithPortsAndNamedPorts()- Tests named port handlingTest_ListWithServicePorts()- Verifies both container and service port fields are populated for normal servicesTest_ListWithHeadlessServicePorts()- Verifies container ports are present for headless servicesDocumentation
Breaking Changes
None. This is a purely additive feature.
Migration Guide
No migration needed. The feature is automatically available when using
telepresence list.Checklist
./CHANGELOG.yml(our release notes are generated from this file).CONTRIBUTING.mdwith any special dev tricks I had to use to work on this code efficiently.CNCF Slack so that the "ok to test" label can be applied.