Skip to content

Commit

Permalink
Make sure the port forwarding protocol is always lowercase
Browse files Browse the repository at this point in the history
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 lima-vm#2411 the hostagent filters on the
protocol values.

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
  • Loading branch information
jandubois committed Oct 30, 2024
1 parent 9afb25c commit 4856e73
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/guestagent/kubernetesservice/kubernetesservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net"
"net/url"
"os"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -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),
})
Expand Down

0 comments on commit 4856e73

Please sign in to comment.