Make daemon support IPv6 adresses
Actually the longhorn manager doesn't support well IPv6 adresses. For
example, in an IPv6-only k8s cluster we can see the following logs:
>  level=info msg="Listening on 2001:db8:caca:8273:187:4:ffff:4f5a:9500
which is missing brackets. The pod fails its readiness probe and never
becomes available.
@@ -3,6 +3,7 @@ package types
import (
"encoding/json"
"fmt"
+ "net"
"os"
"path/filepath"
"regexp"
@@ -155,7 +156,7 @@ func GetCronJobNameForVolumeAndJob(vName, job string) string {
}
func GetAPIServerAddressFromIP(ip string) string {
- return ip + ":" + strconv.Itoa(DefaultAPIPort)
+ return net.JoinHostPort(ip, strconv.Itoa(DefaultAPIPort))
}
func GetDefaultManagerURL() string {
