Skip to content

Commit b249f82

Browse files
committed
Make URL construction IPv6-compatible
While browsing the code, I spotted this line that would break if the IP address was IPv6. Use the Go standard library helper to safely join a host and port, which knows how to handle IPv6 properly. Signed-off-by: Russell Bryant <rbryant@redhat.com>
1 parent 12dbb82 commit b249f82

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/scheduling/pd/scheduler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"net"
78
"time"
89

910
"sigs.k8s.io/controller-runtime/pkg/log"
@@ -133,7 +134,8 @@ func (s *Scheduler) Schedule(ctx context.Context, req *types.LLMRequest) (*types
133134
}
134135

135136
// TODO: should the scheme be conifgurable (e.g., https://)?
136-
prefillURL := fmt.Sprintf("http://%s:%d", prefillRes.TargetPod.GetPod().Address, pool.Spec.TargetPortNumber)
137+
prefillURL := "http://" + net.JoinHostPort(prefillRes.TargetPod.GetPod().Address, fmt.Sprint(pool.Spec.TargetPortNumber))
138+
137139
if req.Headers == nil { // TODO should always be populated?
138140
req.Headers = make(map[string]string)
139141
}

0 commit comments

Comments
 (0)