diff --git a/pkg/tcpproxy/tcp.go b/pkg/tcpproxy/tcp.go index fba4d21be8..33e7a45cbf 100644 --- a/pkg/tcpproxy/tcp.go +++ b/pkg/tcpproxy/tcp.go @@ -20,6 +20,7 @@ import ( "fmt" "io" "net" + "strings" "k8s.io/klog/v2" @@ -46,10 +47,15 @@ func (p *TCPProxy) Get(host string) *TCPServer { return p.Default } + _, parentHost, hasParentHost := strings.Cut(host, ".") + for _, s := range p.ServerList { if s.Hostname == host { return s } + if strings.HasPrefix(s.Hostname, "*.") && hasParentHost && parentHost == s.Hostname[2:] { + return s + } } return p.Default