Don't start up multiple apiserver load balancers

get() is called in a loop until client configuration is successfully
retrieved. Each iteration will try to configure the apiserver proxy,
which will in turn create a new load balancer. Skip creating a new
load balancer if we already have one.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2021-03-08 15:47:14 -08:00 committed by Brad Davidson
parent c0d129003b
commit 8ace8975d2

View File

@ -119,7 +119,7 @@ func (p *proxy) SetAPIServerPort(ctx context.Context, port int) error {
p.apiServerURL = u.String()
p.apiServerEnabled = true
if p.lbEnabled {
if p.lbEnabled && p.apiServerLB == nil {
lbServerPort := p.lbServerPort
if lbServerPort != 0 {
lbServerPort = lbServerPort - 1