Skip to content

Conversation

xieyanker
Copy link
Member

@xieyanker xieyanker commented Aug 27, 2025

Pull Request

What type of this PR

Examples of user facing changes:

  • Bug fixes

目前发现,每次kube-ovn-controller重启都会导致vpc-dns的pod自动跟着重启,看代码发现每次都会执行dep.Spec.Template.Annotations = maps.Clone(oldDeploy.Annotations),会将原有deploy的注释赋值给新deploy的template上,感觉这个逻辑不太对。
Deploy里只有一个自动生成的注释是deployment.kubernetes.io/revision,现有逻辑会造成模板注释中会存在一个旧版本的revision注释,每次ovn-controller重启时都会调用一次update,但vpc-dns的参数没有任何变化,这时不应该重启pod。但是因为deploy模板中存在deployment.kubernetes.io/revision,会导致每次都更新,且版本永远是上一个。
xxx

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 27, 2025
Copy link

@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.

Summary of Changes

Hello @xieyanker, 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!

此PR旨在解决kube-ovn-controller重启时导致vpc-dns Pod不必要重启的问题。通过修改代码,避免将旧部署中自动生成的deployment.kubernetes.io/revision注解复制到新的Pod模板中,从而防止即使vpc-dns参数未发生变化也触发更新和重启,优化了Pod的生命周期管理。

Highlights

  • 修复vpc-dns Pod不必要重启: 移除了在生成vpc-dns Deployment时,将旧Deployment的注解(特别是deployment.kubernetes.io/revision)复制到新Pod模板的逻辑。
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 the bug Something isn't working label Aug 27, 2025
Copy link

@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 修复了 kube-ovn-controller 重启后 vpc-dns Deployment 会被不必要地更新重启的问题。问题根源在于代码将旧 Deployment 对象的注解(包括 deployment.kubernetes.io/revision)复制到了新 Deployment 的 Pod 模板中,这导致了 Pod 模板的哈希值在每次调和时都发生变化,从而触发了不必要的滚动更新。您所做的修改,即移除了这部分注解复制逻辑,是完全正确的,从根本上解决了这个问题。这是一个高质量的修复,做得很好。

@xieyanker xieyanker force-pushed the fix_vpc_dns branch 2 times, most recently from 111aed7 to 2d4cf00 Compare August 27, 2025 10:45
@coveralls
Copy link

coveralls commented Aug 27, 2025

Pull Request Test Coverage Report for Build 17265759559

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 21.228%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/vpc_dns.go 0 2 0.0%
Totals Coverage Status
Change from base Build 17256845099: 0.002%
Covered Lines: 10589
Relevant Lines: 49883

💛 - Coveralls

Signed-off-by: xieyanker <xjsisnice@gmail.com>
@oilbeater oilbeater merged commit fdc1d68 into kubeovn:master Aug 27, 2025
72 checks passed
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 27, 2025
oilbeater pushed a commit that referenced this pull request Aug 27, 2025
Signed-off-by: xieyanker <xjsisnice@gmail.com>
(cherry picked from commit fdc1d68)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants