Skip to content

Commit

Permalink
Support for in-cluster lb
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Jul 26, 2023
1 parent b05d01f commit ef0ba55
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions pkg/agent/manager/loadbalancer/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,26 +1197,28 @@ loop:
}
}

isSuccess := false
for _, value := range m.lbCache {
for _, lbModel := range value.LbModelList {
for retry := 0; retry < 5; retry++ {
if err := aliveClient.LoadBalancer().Create(context.Background(), &lbModel); err == nil {
klog.Infof("reinstallLoxiLbRules: lbModel: %v success", lbModel)
isSuccess = true
break
} else {
if !strings.Contains(err.Error(), "exist") {
klog.Infof("reinstallLoxiLbRules: lbModel: %v retry(%d)", lbModel, retry)
time.Sleep(1 * time.Second)
} else {
if !aliveClient.PeeringOnly {
isSuccess := false
for _, value := range m.lbCache {
for _, lbModel := range value.LbModelList {
for retry := 0; retry < 5; retry++ {
if err := aliveClient.LoadBalancer().Create(context.Background(), &lbModel); err == nil {
klog.Infof("reinstallLoxiLbRules: lbModel: %v success", lbModel)
isSuccess = true
break
} else {
if !strings.Contains(err.Error(), "exist") {
klog.Infof("reinstallLoxiLbRules: lbModel: %v retry(%d)", lbModel, retry)
time.Sleep(1 * time.Second)
} else {
isSuccess = true
break
}
}
}
}
if !isSuccess {
klog.Exit("restart kube-loxilb")
if !isSuccess {
klog.Exit("restart kube-loxilb")
}
}
}
}
Expand Down

0 comments on commit ef0ba55

Please sign in to comment.