-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: egw status update failed #925
Conversation
Signed-off-by: dcwbq <biqiang.wu@daocloud.io>
Codecov Report
@@ Coverage Diff @@
## main #925 +/- ##
=======================================
Coverage 43.98% 43.98%
=======================================
Files 20 20
Lines 3042 3042
=======================================
Hits 1338 1338
Misses 1513 1513
Partials 191 191
Flags with carried forward coverage won't be shown. Click here to find out more. |
@@ -752,7 +782,7 @@ func (r egnReconciler) reAllocatorPolicy(ctx context.Context, policy egress.Poli | |||
} else { | |||
allocatorPolicy := pi.allocatorPolicy | |||
if allocatorPolicy == egress.EipAllocatorRR { | |||
perNode, err := r.allocatorNode("rr", nodeMap) | |||
perNode, err = r.allocatorNode("rr", nodeMap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix: RR 模式分配 EIP失败
#832
} | ||
|
||
perIpv4 = useIpv4sByNode[rander.Intn(len(useIpv4sByNode))].String() | ||
return "", "", fmt.Errorf("No Egress IPV4 is available; policy=%v egw=%v", pi.policy, egw.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RR 模式时,不复用其他 EIP
#846
@@ -1045,6 +1083,7 @@ func setEipStatus(ipv4, ipv6 string, nodeName string, policy egress.Policy, node | |||
nodeMap[nodeName] = eipStatus | |||
} else { | |||
newEipStatus.Name = nodeName | |||
newEipStatus.Status = eipStatus.Status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix:绑定 policy 后,导致节点的 status 丢失。从而导致 defaultEIP 同时绑定到多个节点
#811
@@ -1103,8 +1141,9 @@ func DeletePolicyFromEG(policy egress.Policy, egw *egress.EgressGateway) { | |||
if len(policies) == 0 { | |||
// Release EIP | |||
for x, e := range node.Eips { | |||
if eip.IPv4 == e.IPv4 || eip.IPv6 == e.IPv6 { | |||
if (len(eip.IPv4) != 0 && eip.IPv4 == e.IPv4) || (len(eip.IPv6) != 0 && eip.IPv6 == e.IPv6) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix: 单栈情况下一定会进入该分支,导致删除 policy 时,egw.status 中 policy 信息删除失败
#475
可以参考下 CodeFactor CI 的建议 |
主要解决 egw 分配、回收 IP 的问题,对应了多个 issue :
fix: #846
fix: #832
fix: #811
fix: #475
fix: #836