Skip to content
Discussion options

You must be logged in to vote

@joee33 你说得对,这就是个空白参数——lb 从构造到传递全程没有任何赋值,i.Spec 里也没有可被读进来的来源。

在 0316bc9 上确认过(pkg/ingress/kube/gateway/istio/backend_policies.go):

// :556
lb := &networking.LoadBalancerSettings{}
var retryBudget *networking.TrafficPolicy_RetryBudget
...
// :568  只有这一处读 spec 的字段
if i.Spec.SessionPersistence != nil { ... }   // 只写进 unsupported
if i.Spec.RetryConstraint != nil { ... }      // 只填 retryBudget(:570-582)
...
// :619
LoadBalancer: lb,

:556 和 :619 之间没有 lb. 的任何成员赋值,函数里对 i.Spec 的读取只有 TargetRefs、SessionPersistence、RetryConstraint 三项。在你引的那两行之间插 fmt.Printf("%+v\n", lb),打印出来会是 &{LbPolicy:0 LocalityLbSetting:nil ...} 的零值,对所有 XBackendTrafficPolicy 都一样。

为什么是零值而不是不生效
DestinationRuleCollection 里确实把它透传下去了:

//…

Replies: 6 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@joee33
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by joee33
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants