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

@ -25,9 +25,12 @@ func Register(ctx context.Context, runtime *config.ControlRuntime, endpoints con
endpoints.OnChange(ctx, version.Program+"-apiserver-lb-controller", h.sync)
cl, err := etcd.GetClient(h.ctx, h.runtime, "https://127.0.0.1:2379")
if err != nil {
cl, err = etcd.GetClient(h.ctx, h.runtime, "https://[::1]:2379")
if err != nil {
return err
}
}
h.etcdClient = cl
go func() {

View File

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

View File

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