Skip to content
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

Merged
merged 1 commit into from
Nov 6, 2023
Merged

fix: egw status update failed #925

merged 1 commit into from
Nov 6, 2023

Conversation

biqiangwu
Copy link
Contributor

@biqiangwu biqiangwu commented Nov 3, 2023

主要解决 egw 分配、回收 IP 的问题,对应了多个 issue :

fix: #846
fix: #832
fix: #811
fix: #475
fix: #836

Signed-off-by: dcwbq <biqiang.wu@daocloud.io>
@biqiangwu biqiangwu added the bug Something isn't working label Nov 3, 2023
@biqiangwu biqiangwu added the release/none should not recoded in new release label Nov 3, 2023
Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #925 (625cf38) into main (d2a8873) will not change coverage.
Report is 14 commits behind head on main.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #925   +/-   ##
=======================================
  Coverage   43.98%   43.98%           
=======================================
  Files          20       20           
  Lines        3042     3042           
=======================================
  Hits         1338     1338           
  Misses       1513     1513           
  Partials      191      191           
Flag Coverage Δ
unittests 43.98% <ø> (ø)

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)
Copy link
Contributor Author

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)
Copy link
Contributor Author

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
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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

@lou-lan
Copy link
Collaborator

lou-lan commented Nov 3, 2023

可以参考下 CodeFactor CI 的建议 If block ends with a return statement, so drop this else and outdent its block

@weizhoublue weizhoublue added release/bug bug pr recoded in new release and removed release/none should not recoded in new release labels Nov 3, 2023
@lou-lan lou-lan merged commit 3627c00 into main Nov 6, 2023
35 of 38 checks passed
@lou-lan lou-lan deleted the fix/egw-multiple-bugs branch November 6, 2023 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release/bug bug pr recoded in new release
Projects
None yet
4 participants