Skip to content

Conversation

@luohua13
Copy link
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:

  1. CheckHealth is always return true, true when removing the device plugin from the gpu node.
  2. The scheduler component and plugin component continuously update different prefix values ​​for the hami.io/node-handshake key on the node annotations. The correct way is for the device plugin to update regularly and the scheduler component to check the status.

@hami-robot hami-robot bot added kind/bug Something isn't working dco-signoff: yes labels Oct 23, 2025
@hami-robot
Copy link
Contributor

hami-robot bot commented Oct 23, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: luohua13
Once this PR has been reviewed and has the lgtm label, please assign wawa0210 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hami-robot hami-robot bot added the size/S label Oct 23, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

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

This pull request resolves a bug where GPU nodes could still be scheduled for device-dependent workloads even after their associated device plugin was removed. The solution involves refining the device plugin's health check mechanism by standardizing the hami.io/node-handshake annotation format and centralizing its management. This ensures that the scheduler accurately reflects the availability of devices on a node, preventing scheduling errors and improving overall resource management reliability.

Highlights

  • Improved Device Plugin Health Check: The CheckHealth function now accurately determines the presence and health of device plugins, preventing nodes from being erroneously scheduled for devices that are no longer available after the plugin's removal.
  • Standardized Handshake Annotation: The hami.io/node-handshake annotation value has been standardized to include a Requesting_ prefix and a precise time.DateTime formatted timestamp, which is crucial for reliable health status checks by the scheduler.
  • Centralized Annotation Management: Global HandshakeAnnos and RegisterAnnos variables have been moved to a shared util package, ensuring consistent access and management across different components and reducing potential for discrepancies.
  • Typo Correction: A minor typo in the RegistrInAnnotation function name has been corrected to RegisterInAnnotation.
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.

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

This pull request aims to fix a bug where nodes remain schedulable after a device plugin has been removed. The approach involves changing the handshake mechanism: the device plugin now periodically reports a 'Requesting' status with a timestamp. If this timestamp expires, the node is marked as unhealthy.

My review identifies a critical vulnerability in the CheckHealth function that could lead to a panic, and also points out that the original bug (node being schedulable with a missing handshake annotation) is not fully resolved. I've provided a code suggestion to make the function more robust by handling malformed or missing annotations correctly. I also recommend enhancing the test suite to cover these critical edge cases.

@archlitchi
Copy link
Member

please pass the CI check

luohua13 and others added 8 commits October 30, 2025 21:58
Signed-off-by: luohua13 <[email protected]>
* refactor: simplify configuration validation logic

Signed-off-by: yxxhero <[email protected]>

* refactor: streamline configuration validation logic

Signed-off-by: yxxhero <[email protected]>

---------

Signed-off-by: yxxhero <[email protected]>
…roject-HAMi#1441)

* feat: add GeneratePodNamespaceName function and corresponding tests

Signed-off-by: yxxhero <[email protected]>

* Update pkg/util/nodelock/nodelock.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: yxxhero <[email protected]>

* fix lint

Signed-off-by: yxxhero <[email protected]>

* fix tests

Signed-off-by: yxxhero <[email protected]>

---------

Signed-off-by: yxxhero <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#1443)

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v5...v6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1. delete duplicate event type definition, use common package
2. support vendor device report custom event

Signed-off-by: Lei Guo <[email protected]>
Co-authored-by: Lei Guo <[email protected]>
@hami-robot hami-robot bot added size/XXL and removed size/S labels Oct 30, 2025
@luohua13 luohua13 closed this Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants