Skip to content

Commit 15bf34c

Browse files
committed
feat: allow ipv6 services
1 parent 2672af2 commit 15bf34c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/servicecheck/servicecheck.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (c *Checker) APIServerDirect(ctx context.Context) string {
143143
return skippedStr
144144
}
145145

146-
apiurl := fmt.Sprintf("https://%s:%s/version", c.KubernetesServiceHost, c.KubernetesServicePort)
146+
apiurl := fmt.Sprintf("https://%s/version", net.JoinHostPort(c.KubernetesServiceHost, c.KubernetesServicePort))
147147

148148
return c.doRequest(ctx, apiurl, false)
149149
}
@@ -154,7 +154,7 @@ func (c *Checker) APIServerDNS(ctx context.Context) string {
154154
return skippedStr
155155
}
156156

157-
apiurl := fmt.Sprintf("https://%s:%s/version", c.KubernetesServiceDNS, c.KubernetesServicePort)
157+
apiurl := fmt.Sprintf("https://%s/version", net.JoinHostPort(c.KubernetesServiceDNS, c.KubernetesServicePort))
158158

159159
return c.doRequest(ctx, apiurl, false)
160160
}
@@ -190,8 +190,8 @@ func (c *Checker) measure(ctx context.Context, wg *sync.WaitGroup, res *sync.Map
190190

191191
func podIPtoURL(podIP string, useTLS bool) string {
192192
if useTLS {
193-
return "https://" + podIP + ":8443/alwayshappy"
193+
return "https://" + net.JoinHostPort(podIP, "8443") + "/alwayshappy"
194194
}
195195

196-
return "http://" + podIP + ":8080/alwayshappy"
196+
return "http://" + net.JoinHostPort(podIP, "8080") + "/alwayshappy"
197197
}

0 commit comments

Comments
 (0)