Skip to content

Conversation

@wppzxc
Copy link
Contributor

@wppzxc wppzxc commented Oct 20, 2025

update node exgateway label to true when it is readyNode for providernetwork.status

Pull Request

What type of this PR

Examples of user facing changes:

  • Bug fixes

当node在provider-network资源中是ready状态,则讲节点label: ovn.kubernetes.io/external-gw 改为true
通过这个方式修复默认vpc不启用外部网络时,网关节点label: ovn.kubernetes.io/external-gw 改为false的问题。

Which issue(s) this PR fixes

Fixes #5686

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Oct 20, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @wppzxc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在解决一个关于 provider-network 状态下节点标签更新的错误。它通过确保在 provider-network 上被识别为“就绪”的节点正确地获得 ovn.kubernetes.io/external-gw=true 标签来修复此问题。这可以防止在默认 VPC 未使用外部网络时,该标签被错误地设置为 false 的情况。

Highlights

  • 修复节点标签更新逻辑: 当节点在 provider-network 资源中处于 ready 状态时,确保将其 ovn.kubernetes.io/external-gw 标签更新为 true
  • 解决特定场景下的标签错误: 修复了当默认 VPC 未启用外部网络时,网关节点 ovn.kubernetes.io/external-gw 标签被错误地设置为 false 的问题。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added bug Something isn't working go Pull requests that update Go code labels Oct 20, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

这个 PR 修复了当默认 VPC 未启用外部网络时,作为 provider-network 网关节点的 ovn.kubernetes.io/external-gw 标签被错误地设置为 false 的问题。修改的逻辑是在 resyncProviderNetworkStatus 函数中,当一个节点对于 provider-networkready 状态时,主动检查并将其 ovn.kubernetes.io/external-gw 标签更新为 true

整体逻辑是合理的,但我在代码中发现了一个日志记录问题,可能会在调试时引起混淆。具体请看我的评论。

@coveralls
Copy link

Pull Request Test Coverage Report for Build 18649962737

Details

  • 0 of 7 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.003%) to 21.145%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/provider_network.go 0 7 0.0%
Totals Coverage Status
Change from base Build 18648183394: -0.003%
Covered Lines: 10731
Relevant Lines: 50749

💛 - Coveralls

@oilbeater
Copy link
Collaborator

provider-network 的逻辑应该和 external-gw 无关,并且现在的改法会导致所有没有label的 node 也被更新为 true。
@zbb88888 可以看下我理解的有没有问题。

@wppzxc
Copy link
Contributor Author

wppzxc commented Oct 29, 2025

provider-network 的逻辑应该和 external-gw 无关,并且现在的改法会导致所有没有label的 node 也被更新为 true。 @zbb88888 可以看下我理解的有没有问题。

我理解provider network中配置的节点就是external-gw节点,所以就将这些节点都打上label

@zbb88888
Copy link
Collaborator

provider-network 和 external-gw节点 是互相独立的,

external gw 是需要出公网的VPC 的公网出口的 LRP 在哪个节点上。

这个就应该用 node label 手动维护。因为除非明确人为打标签,kube-ovn 才知道哪个节点能够作为出口。

而且哪个 vlan subnet 是公网,其实 provider-network 是不相关的。只有管理员才知道

@wppzxc
Copy link
Contributor Author

wppzxc commented Oct 30, 2025

provider-network 和 external-gw节点 是互相独立的,

external gw 是需要出公网的VPC 的公网出口的 LRP 在哪个节点上。

这个就应该用 node label 手动维护。因为除非明确人为打标签,kube-ovn 才知道哪个节点能够作为出口。

而且哪个 vlan subnet 是公网,其实 provider-network 是不相关的。只有管理员才知道

那provider network中还选择节点干什么呢,如果是external gw节点统一出公网,provider network就不需要指定节点了吧,
provider network会关联vlan和subnet,最终公网ip是通过subnet中获取的,所以provider network是间接指定了公网配置的
如果用node label手动维护也没问题,controller中为什么会自动给改成false,而且是根据external gw configmap中的配置来判断的,这个cm中的字段其实和provider network, vlan组合配置的内容是类似的,都是选择公网出口节点和对应的网卡

@zbb88888
Copy link
Collaborator

  1. provider-network 只是给 underlay vlan subnet 用的,公网使用只是 underlay vlan subnet 的一种场景
  2. 根据 external gw configmap 中的配置也是一种人工手动指定的方式
  3. controller 中为什么会自动给改成 false:这里如果没有依据external gw configmap 中的配置,我认为是一种bug

@wppzxc
Copy link
Contributor Author

wppzxc commented Nov 1, 2025

  1. provider-network 只是给 underlay vlan subnet 用的,公网使用只是 underlay vlan subnet 的一种场景
  2. 根据 external gw configmap 中的配置也是一种人工手动指定的方式
  3. controller 中为什么会自动给改成 false:这里如果没有依据external gw configmap 中的配置,我认为是一种bug

但是实际用起来会发现,external gw label为false的话,provider network也不通了,所有的provider network都通过label指定公网出口节点出去吗

@wppzxc
Copy link
Contributor Author

wppzxc commented Nov 1, 2025

provider-network 和 external-gw节点 是互相独立的,

external gw 是需要出公网的VPC 的公网出口的 LRP 在哪个节点上。

这个就应该用 node label 手动维护。因为除非明确人为打标签,kube-ovn 才知道哪个节点能够作为出口。

而且哪个 vlan subnet 是公网,其实 provider-network 是不相关的。只有管理员才知道

我看了一下openstack中provider network和external network之间的关系,external network实际上是指定了某个provider network作为公网网络使用,可以从这个网络中创建floating ip挂载使用;
那么kube-ovn中配置公网网络时创建的configmap “ovn-external-gw-config”中是否应该配置使用哪个provider network、vlan、subnet,而不是像现在这样配置了节点以及网卡和网关,导致br-external网桥除了桥接provider network中的网卡,还桥接了这个configmap中指定的网卡
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update Go code size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 关于开启EIP、FIP和SNAT配置的疑问

4 participants