From 9aaa7bbdadaff5895776c5ae928fc9f25a9d1edd Mon Sep 17 00:00:00 2001 From: Jan Dubois Date: Wed, 30 Oct 2024 15:19:09 -0700 Subject: [PATCH] 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 --- pkg/guestagent/kubernetesservice/kubernetesservice.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/guestagent/kubernetesservice/kubernetesservice.go b/pkg/guestagent/kubernetesservice/kubernetesservice.go index e0e5d473084..9dd75ba9c8b 100644 --- a/pkg/guestagent/kubernetesservice/kubernetesservice.go +++ b/pkg/guestagent/kubernetesservice/kubernetesservice.go @@ -7,6 +7,7 @@ import ( "net" "net/url" "os" + "strings" "sync" "time" @@ -24,7 +25,7 @@ type Protocol string const ( // UDP/SCTP when lima port forwarding works on those protocols. - TCP Protocol = "TCP" + TCP Protocol = "tcp" ) type Entry struct { @@ -142,7 +143,7 @@ func (s *ServiceWatcher) GetPorts() []Entry { } entries = append(entries, Entry{ - Protocol: Protocol(portEntry.Protocol), + Protocol: Protocol(strings.ToLower(string(portEntry.Protocol))), IP: net.ParseIP("0.0.0.0"), Port: uint16(port), })