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

do not need to delete pg when update networkpolicy #1959

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

hongzhen-ma
Copy link
Collaborator

@hongzhen-ma hongzhen-ma commented Oct 12, 2022

What type of this PR

  • Bug fixes

do not need to delete pg when update networkpolicy

Which issue(s) this PR fixes:

Fixes #1878

@hongzhen-ma hongzhen-ma marked this pull request as draft October 13, 2022 03:32
@hongzhen-ma hongzhen-ma marked this pull request as ready for review October 13, 2022 08:50
pkg/controller/network_policy.go Outdated Show resolved Hide resolved
pkg/controller/network_policy.go Outdated Show resolved Hide resolved
@oilbeater oilbeater added bug Something isn't working need backport labels Oct 17, 2022
@hongzhen-ma hongzhen-ma force-pushed the networkpolicy branch 2 times, most recently from 4b1362f to 89175f5 Compare October 28, 2022 08:00
@hongzhen-ma
Copy link
Collaborator Author

hongzhen-ma commented Oct 28, 2022

企业微信截图_839e2a94-1168-4320-a500-e9f853896aca

测试确认,不能将 acl 删除放在 acl 创建逻辑中,否则会导致已经创建的 acl 被删除
同时,也不能将删除 acl 的动作去掉,否则会造成 acl 残留

在删除 DeletePortGroup 之后,已经减少了 acl 删除与创建之间,networkpolicy 导致流量短暂通的问题。相比功能不能用,这个bug的优先级要低一些。

@hongzhen-ma
Copy link
Collaborator Author

hongzhen-ma commented Oct 31, 2022

测试在同一个 transaction 中,同时执行 删除与添加 acl 的动作,遇到部分情况下,默认添加的 drop 规则没有添加上的情况
企业微信截图_40f64d7b-9e43-422d-9edd-bd6855264212

命令行确认是正确的,手动执行的话,就有 drop 规则生成

企业微信截图_28a26d8d-6866-418c-a5d1-cfc44ce8c00e

更新networkpolicy,从 allow-all 变更为 deny-all,可能是时序问题导致的 drop 规则丢失

image

@hongzhen-ma
Copy link
Collaborator Author

1、删除 acl 的动作,只能在循环外执行一次,删除之后,就只能执行添加的动作。
否则可能在循环的下次操作中,将上次创建的acl 删除掉。双栈的情况,在执行 v6 acl 创建的时候,会将 v4 acl 删除掉
2、删除与创建动作,要分开执行。存在时序冲突的问题,参考上边截图示例。

@hongzhen-ma
Copy link
Collaborator Author

hongzhen-ma commented Nov 1, 2022

如果将 drop ACL的 --may-exist 去掉,就会在创建 acl 时候出现冲突
企业微信截图_21b75932-f7e9-488e-ad87-414debd7ec1d

这也证明了,在更新networkpolicy时候,drop acl 是存在的。但是之前的测试结果,在更新之后,drop acl 就不见了,应该是被删掉了。

@hongzhen-ma
Copy link
Collaborator Author

使用--id 指定 acl 参数,创建acl,在同一个transaction的命令行中,指定的 --id 参数不能重复,否则有以下报错
企业微信截图_a787e227-6122-49d2-b9f9-8c4b31774565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NetowrkPolicy break when change to log annotation
2 participants