Skip to content

Commit 9aaa7bb

Browse files
committed
Make sure the port forwarding protocol is always lowercase
The ServicePort.Protocol is always uppercase, e.g. "TCP", but the api.IPPort.protocol is always lowercase, i.e. "tcp". Since UDP support was added in #2411 the hostagent filters on the protocol values. Signed-off-by: Jan Dubois <[email protected]>
1 parent 9afb25c commit 9aaa7bb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/guestagent/kubernetesservice/kubernetesservice.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net"
88
"net/url"
99
"os"
10+
"strings"
1011
"sync"
1112
"time"
1213

@@ -24,7 +25,7 @@ type Protocol string
2425
const (
2526
// UDP/SCTP when lima port forwarding works on those protocols.
2627

27-
TCP Protocol = "TCP"
28+
TCP Protocol = "tcp"
2829
)
2930

3031
type Entry struct {
@@ -142,7 +143,7 @@ func (s *ServiceWatcher) GetPorts() []Entry {
142143
}
143144

144145
entries = append(entries, Entry{
145-
Protocol: Protocol(portEntry.Protocol),
146+
Protocol: Protocol(strings.ToLower(string(portEntry.Protocol))),
146147
IP: net.ParseIP("0.0.0.0"),
147148
Port: uint16(port),
148149
})

0 commit comments

Comments
 (0)