Fixed client URL

Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
This commit is contained in:
Roberto Bonafiglia 2022-03-30 10:59:39 +02:00
parent dda409b041
commit e29771b9ff
3 changed files with 8 additions and 6 deletions

View File

@ -26,7 +26,10 @@ func Register(ctx context.Context, runtime *config.ControlRuntime, endpoints con
cl, err := etcd.GetClient(h.ctx, h.runtime, "https://127.0.0.1:2379") cl, err := etcd.GetClient(h.ctx, h.runtime, "https://127.0.0.1:2379")
if err != nil { if err != nil {
return err cl, err = etcd.GetClient(h.ctx, h.runtime, "https://[::1]:2379")
if err != nil {
return err
}
} }
h.etcdClient = cl h.etcdClient = cl

View File

@ -460,9 +460,10 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
if ip == "" { if ip == "" {
ip = "127.0.0.1" ip = "127.0.0.1"
if IPv6only { if IPv6only {
ip = "[::1]" ip = "::1"
} }
} else if utilsnet.IsIPv6String(ip) { }
if utilsnet.IsIPv6String(ip) {
ip = fmt.Sprintf("[%s]", ip) ip = fmt.Sprintf("[%s]", ip)
} }

View File

@ -308,11 +308,9 @@ func genClientCerts(config *config.Control) error {
var certGen bool var certGen bool
IPv6OnlyService, _ := util.IsIPv6OnlyCIDRs(config.ServiceIPRanges) IPv6OnlyService, _ := util.IsIPv6OnlyCIDRs(config.ServiceIPRanges)
ip := "" ip := "127.0.0.1"
if IPv6OnlyService { if IPv6OnlyService {
ip = "[::1]" ip = "[::1]"
} else {
ip = "127.0.0.1"
} }
apiEndpoint := fmt.Sprintf("https://%s:%d", ip, config.APIServerPort) apiEndpoint := fmt.Sprintf("https://%s:%d", ip, config.APIServerPort)