feat: support newline and comma-whitespace external host lists for auto-discovery (#468)

This commit is contained in:
Supratim Ghose
2025-10-25 03:18:34 +05:30
committed by GitHub
parent 4b5cb125e4
commit 22ec39b805
6 changed files with 113 additions and 10 deletions
+5 -5
View File
@@ -3,6 +3,10 @@ package server
import (
"context"
"fmt"
"net"
"strconv"
"sync"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
apps "k8s.io/api/apps/v1"
@@ -14,10 +18,6 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"net"
"strconv"
"strings"
"sync"
)
const (
@@ -238,7 +238,7 @@ func (w *K8sWatcher) extractRoutableServices(obj interface{}) []*routableService
routableServices := make([]*routableService, 0)
if externalServiceName, exists := service.Annotations[AnnotationExternalServerName]; exists {
serviceNames := strings.Split(externalServiceName, ",")
serviceNames := SplitExternalHosts(externalServiceName)
for _, serviceName := range serviceNames {
routableServices = append(routableServices, w.buildDetails(service, serviceName))
}