mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
agnhost: allow to disable udp listener on netexec
There are some tests that doesn't need the UDP listener, so they can disable it. This is specially needed for tests that use hostNetwork pods, if 2 pods try to bind to the same port, the test will fail because one of the pod can't be scheduled because of the port conflict. To keep backwards compatibility, we can add an option to disable the UDP listener by setting the port number to -1, that is consistent with the SCTP implementation.
This commit is contained in:
parent
bbd809cbd0
commit
2bf38ed86b
@ -417,6 +417,8 @@ It will also start a UDP server on the indicated UDP port that responds to the f
|
||||
- `echo <msg>`: Returns the given `<msg>`
|
||||
- `clientip`: Returns the request's IP address
|
||||
|
||||
The UDP server can be disabled by setting `--udp-port -1`.
|
||||
|
||||
Additionally, if (and only if) `--sctp-port` is passed, it will start an SCTP server on that port,
|
||||
responding to the same commands as the UDP server.
|
||||
|
||||
|
@ -1 +1 @@
|
||||
2.33
|
||||
2.34
|
||||
|
@ -106,12 +106,14 @@ will be upgraded to HTTPS. The image has default, "localhost"-based cert/privkey
|
||||
If "--http-override" is set, the HTTP(S) server will always serve the override path & options,
|
||||
ignoring the request URL.
|
||||
|
||||
It will also start a UDP server on the indicated UDP port that responds to the following commands:
|
||||
It will also start a UDP server on the indicated UDP port and addresses that responds to the following commands:
|
||||
|
||||
- "hostname": Returns the server's hostname
|
||||
- "echo <msg>": Returns the given <msg>
|
||||
- "clientip": Returns the request's IP address
|
||||
|
||||
The UDP server can be disabled by setting --udp-port to -1.
|
||||
|
||||
Additionally, if (and only if) --sctp-port is passed, it will start an SCTP server on that port,
|
||||
responding to the same commands as the UDP server.
|
||||
`,
|
||||
@ -168,14 +170,19 @@ func main(cmd *cobra.Command, args []string) {
|
||||
addRoutes(http.DefaultServeMux, exitCh)
|
||||
}
|
||||
|
||||
udpBindTo, err := parseAddresses(udpListenAddresses)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
// UDP server
|
||||
if udpPort != -1 {
|
||||
udpBindTo, err := parseAddresses(udpListenAddresses)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for _, address := range udpBindTo {
|
||||
go startUDPServer(address, udpPort)
|
||||
}
|
||||
}
|
||||
|
||||
for _, address := range udpBindTo {
|
||||
go startUDPServer(address, udpPort)
|
||||
}
|
||||
// SCTP server
|
||||
if sctpPort != -1 {
|
||||
go startSCTPServer(sctpPort)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user