Skip to content

Commit 16e1c87

Browse files
committed
some fix
Signed-off-by: roc <[email protected]>
1 parent e2ee378 commit 16e1c87

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

charts/tke-extend-network-controller/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ concurrency:
2525
dedicatedClbListenerController: 30
2626
podController: 30
2727
nodeController: 30
28-
clbPortPoolController: 1
28+
clbPortPoolController: 10
2929
dedicatedClbServiceController: 1
3030

3131
# -- Logging otpions of the controller

internal/controller/clbportpool_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"reflect"
2323
"strings"
2424

25+
portpoolutil "github.com/imroc/tke-extend-network-controller/internal/portpool/util"
2526
"github.com/pkg/errors"
2627
corev1 "k8s.io/api/core/v1"
2728
"k8s.io/apimachinery/pkg/runtime"
@@ -267,6 +268,10 @@ func (r *CLBPortPoolReconciler) ensureLb(ctx context.Context, pool *networkingv1
267268

268269
// 同步端口池
269270
func (r *CLBPortPoolReconciler) sync(ctx context.Context, pool *networkingv1alpha1.CLBPortPool) (result ctrl.Result, err error) {
271+
// 确保分配器缓存中存在该 port pool,放在最开头,避免同时创建 CLBPortPool 和 CLBBinding 导致分配端口时找不到 pool
272+
if !portpool.Allocator.IsPoolExists(pool.Name) { // 分配器缓存中不存在,则添加
273+
portpool.Allocator.EnsurePool(portpoolutil.NewPortPool(pool, r.Client, r.Recorder))
274+
}
270275
// 初始化状态
271276
if pool.Status.State == "" {
272277
pool.Status.State = networkingv1alpha1.CLBPortPoolStatePending

pkg/clb/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ func IsLbIdNotFoundError(err error) bool {
99
}
1010

1111
func IsLoadBalancerNotExistsError(err error) bool {
12-
return strings.Contains(err.Error(), "LoadBalancer not exist")
12+
return strings.Contains(err.Error(), "LoadBalancer not exist") || strings.Contains(err.Error(), "LB not exist")
1313
}
1414

1515
func IsRequestLimitExceededError(err error) bool {

0 commit comments

Comments
 (0)