Repository navigation
feat(echo-basic): Add UDP Echo server - #4871
Conversation
| | `UDP_ECHO_SERVER` | yes | _unset_ | When set, echo-basic runs the UDP/TCP echo server. | | ||
| | `UDP_PORT` | no | `8080` | Port the UDP/TCP echo server listens on. | | ||
| | `NAMESPACE` | no | empty | Returned in the JSON envelope as `namespace`. | | ||
| | `INGRESS_NAME` | no | empty | Returned in the JSON envelope as `ingress`. | |
There was a problem hiding this comment.
What does ingress name mean? How will it be used in the tests?
There was a problem hiding this comment.
this actually came from the HTTP echo server, where you could pass the route name. I copied / pasted to tcp echo server, and Zac probably copied pasted here. That said, we should probably clean it from here (either now or on a followup)
There was a problem hiding this comment.
yes, it's copied from the HTTP echoserver. I assume its the Ingress name that routed to the pod, it would probably be better to call it the Gateway now.
| go func() { errCh <- serveUDP(port, podContext) }() | ||
| go func() { errCh <- serveTCP(port, podContext) }() | ||
|
|
||
| if err := <-errCh; err != nil { |
There was a problem hiding this comment.
nit: I suggest to use errgroup.Group instead, because right now if both goroutines fail, the second error is silently dropped.
| } | ||
|
|
||
| // EchoResponse is the JSON envelope this server returns for every datagram or | ||
| // TCP message it receives. |
There was a problem hiding this comment.
in here for now is just the datagrams
|
|
||
| errCh := make(chan error, 2) | ||
| go func() { errCh <- serveUDP(port, podContext) }() | ||
| go func() { errCh <- serveTCP(port, podContext) }() |
There was a problem hiding this comment.
we must not serveTCP here right now, it may conflict with the TCP_ECHO server and for now it is out of scope
|
/approve just needs to fix the linter and we are good to go here |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rikatz, zac-nixon The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ba44196 to
983bb2d
Compare
|
/lgtm |
Add a UDP and TCP echo server to the echo-basic binary, enabled by setting the UDP_ECHO_SERVER environment variable. The server listens on the configured port (UDP_PORT, default 8080) for both UDP and TCP and replies to each datagram or first line of TCP input with a JSON envelope of the form:
{
"request": "",
"namespace": "",
"ingress": "<INGRESS_NAME env var>",
"service": "<SERVICE_NAME env var>",
"pod": "<POD_NAME env var>"
}
The pod context fields mirror the existing HTTP echo handler so tests that route to multiple backends can identify the responding replica. Routing both UDP and TCP on the same port lets a single backend Service serve a Gateway with mixed UDP/TCP listeners on the same port.
Also bump the protoc-gen-go version pin in hack/update-protos.sh from v1.36.10 to v1.36.11 to match the regenerated grpcecho.pb.go.
For use in: #4861
/kind test
/area conformance-machinery