Skip to content

Commit 95cf92a

Browse files
authored
use port.Name to populate srv records
1 parent 95daddd commit 95cf92a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/service.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,13 +724,19 @@ func (sc *serviceSource) extractNodePortEndpoints(svc *v1.Service, hostname stri
724724
// see https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names
725725
serviceName := svc.ObjectMeta.Name
726726

727+
// figure out the port name
728+
portName := strings.ToLower(string(port.Name))
729+
if portName == "" {
730+
portName = serviceName
731+
}
732+
727733
// figure out the protocol
728734
protocol := strings.ToLower(string(port.Protocol))
729735
if protocol == "" {
730736
protocol = "tcp"
731737
}
732738

733-
recordName := fmt.Sprintf("_%s._%s.%s", serviceName, protocol, hostname)
739+
recordName := fmt.Sprintf("_%s._%s.%s", portName, protocol, hostname)
734740

735741
var ep *endpoint.Endpoint
736742
if ttl.IsConfigured() {

0 commit comments

Comments
 (0)