Skip to content

feat(echo-basic): Add UDP Echo server - #4871

Merged
k8s-ci-robot merged 2 commits into
kubernetes-sigs:mainfrom
zac-nixon:znixon/udp-echo-server
May 18, 2026
Merged

k8s-ci-robot merged 2 commits into
kubernetes-sigs:mainfrom
zac-nixon:znixon/udp-echo-server

Conversation

@zac-nixon

Copy link
Copy Markdown
Contributor

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

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/test area/conformance-machinery Issues or PRs related to the machinery and the suite used to run conformance tests. labels May 15, 2026
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 15, 2026
| `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`. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does ingress name mean? How will it be used in the tests?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) }()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we must not serveTCP here right now, it may conflict with the TCP_ECHO server and for now it is out of scope

@rikatz

rikatz commented May 18, 2026

Copy link
Copy Markdown
Member

/approve

just needs to fix the linter and we are good to go here

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 18, 2026
@zac-nixon
zac-nixon force-pushed the znixon/udp-echo-server branch from ba44196 to 983bb2d Compare May 18, 2026 21:23
@rikatz

rikatz commented May 18, 2026

Copy link
Copy Markdown
Member

/lgtm
thanks @zac-nixon

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 18, 2026
@k8s-ci-robot
k8s-ci-robot merged commit a216203 into kubernetes-sigs:main May 18, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/conformance-machinery Issues or PRs related to the machinery and the suite used to run conformance tests. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/test lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants