Skip to content

Commit 4ee98bb

Browse files
committed
add debug log
Signed-off-by: roc <[email protected]>
1 parent a7517f6 commit 4ee98bb

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

internal/controller/clbbinding.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ func (r *CLBBindingReconciler[T]) ensurePortBound(ctx context.Context, backend c
341341
alreadyAdded = true
342342
} else {
343343
targetToDelete = append(targetToDelete, target)
344+
log.FromContext(ctx).V(10).Info("remove unexpected target", "got", target, "expect", backendTarget)
344345
}
345346
}
346347
// 清理多余的 rs

pkg/clb/target.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
clb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317"
88
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
9+
"sigs.k8s.io/controller-runtime/pkg/log"
910
)
1011

1112
func ContainsTarget(ctx context.Context, region, lbId string, port int64, protocol string, target Target) (bool, error) {
@@ -167,6 +168,7 @@ func RegisterTargets(ctx context.Context, region, lbId, listenerId string, targe
167168
mu.Lock()
168169
defer mu.Unlock()
169170
resp, err := client.RegisterTargetsWithContext(ctx, req)
171+
log.FromContext(ctx).V(10).Info("RegisterTargets", "req", req, "resp", resp)
170172
if err != nil {
171173
return err
172174
}
@@ -180,6 +182,7 @@ func DescribeTargets(ctx context.Context, region, lbId, listenerId string) (targ
180182
req.ListenerIds = []*string{&listenerId}
181183
client := GetClient(region)
182184
resp, err := client.DescribeTargetsWithContext(ctx, req)
185+
log.FromContext(ctx).V(10).Info("DescribeTargets", "req", req, "resp", resp)
183186
if err != nil {
184187
return
185188
}

0 commit comments

Comments
 (0)