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

update policy route when subnet cidr is changed #3587

Merged
merged 1 commit into from
Jan 4, 2024
Merged

Conversation

hongzhen-ma
Copy link
Collaborator

Pull Request

What type of this PR

  • Bug fixes

Which issue(s) this PR fixes

Fixes #(issue-number)

WHAT

copilot:summary

copilot:poem

HOW

copilot:walkthrough

pkg/controller/subnet.go Outdated Show resolved Hide resolved
@@ -2957,3 +2968,67 @@ func (c *Controller) clearOldU2OResource(subnet *kubeovnv1.Subnet) error {
}
return nil
}

func (c *Controller) checkAndDeleteUnusedPolicyRouteForSubnet(subnet *kubeovnv1.Subnet, isCommonRoute bool) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common route 指的是什么

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于每个子网,创建后都会添加一条 ip4.dst == subnet.spec.Cidr 或者 ip6.dst == subnet.spec.Cidr,优先级为 31000,action 为 allow 的策略路由,这条路由在添加的时候,调用的function 为 addCommonRoutesForSubnet,所以认为这条路由是 commonPolicyRoute
另外,还会根据子网是 分布式或者集中式,分布式添加 ip4.src == subnet.node portgroup 29000 allow 的路由,集中式添加 ip4.src == subnet.spec.cidr 29000 allow 的路由,这两条路由是和具体子网类型相关的,不是每个子网都添加一样的策略路由,所以这两条认为是 非commonRoute 的路由

pkg/controller/subnet.go Outdated Show resolved Hide resolved
@hongzhen-ma hongzhen-ma merged commit 5589e8e into master Jan 4, 2024
59 checks passed
@hongzhen-ma hongzhen-ma deleted the policyroute branch January 4, 2024 02:24
hongzhen-ma added a commit that referenced this pull request Jan 4, 2024
zbb88888 pushed a commit that referenced this pull request Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants