Skip to content

fix(chart): declare metrics port on vGPU monitor container - #1990

Merged
hami-robot[bot] merged 1 commit into
Project-HAMi:masterfrom
ntheanh201:fix/vgpu-monitor-port
Jul 1, 2026
Merged

fix(chart): declare metrics port on vGPU monitor container#1990
hami-robot[bot] merged 1 commit into
Project-HAMi:masterfrom
ntheanh201:fix/vgpu-monitor-port

Conversation

@ntheanh201

@ntheanh201 ntheanh201 commented Jun 30, 2026

Copy link
Copy Markdown
Member

What type of PR is this?

/kind bug

What this PR does / why we need it:

The vgpu-monitor container in the device-plugin DaemonSet serves Prometheus
metrics on :9394 (the --metrics-bind-address default in cmd/vGPUmonitor/main.go),
and the hami-device-plugin-monitor Service forwards to that port. However, the
port was never declared in the container's ports: spec.

This means the metrics endpoint is not discoverable from the Pod spec (e.g. for
PodMonitor/ServiceMonitor selectors that reference a named port).

This PR declares the named metrics containerPort (9394) on the vgpu-monitor
container, matching the convention already used by the scheduler Deployment.

The monitor Service is intentionally left unchanged: it keeps a numeric
targetPort: 9394. A numeric targetPort routes to any selected pod serving on
that port, whereas a named targetPort would require every pod the Service
selects to declare a container port of that name. Keeping it numeric makes this
change fully non-breaking.

This replaces #1085, whose branch had drifted too far from master to rebase.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
Verified with helm template; the container now renders a metrics port and the
Service targetPort remains the numeric 9394 (unchanged from master).

Does this PR introduce a user-facing change?:

NONE

AI assistance disclosure: this change was prepared with the help of Claude Code (per CONTRIBUTING.md).

Summary by CodeRabbit

  • New Features
    • Exposed a metrics port for the vGPU monitor container, making its metrics endpoint explicitly available on TCP port 9394.

@hami-robot hami-robot Bot added kind/bug Something isn't working dco-signoff: yes labels Jun 30, 2026
@hami-robot hami-robot Bot added the size/XS label Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b0a9f9d8-cda3-439d-a637-4747794b0a68

📥 Commits

Reviewing files that changed from the base of the PR and between 9621c73 and 567bd06.

📒 Files selected for processing (1)
  • charts/hami/templates/device-plugin/daemonsetnvidia.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/hami/templates/device-plugin/daemonsetnvidia.yaml

📝 Walkthrough

Walkthrough

Adds a ports block to the vgpu-monitor container in the daemonset template, declaring a TCP port named metrics on container port 9394.

Changes

Metrics Port Declaration

Layer / File(s) Summary
Container port declaration
charts/hami/templates/device-plugin/daemonsetnvidia.yaml
Adds a ports section to the vgpu-monitor container exposing a TCP metrics port on container port 9394.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Poem

A tiny port, nine-three-nine-four,
Now hops open, a metrics door.
The monitor sniffs, the numbers flow,
This rabbit thumps approval, so!
🐇📊✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: declaring a named metrics port on the vGPU monitor container.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

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

Copy link
Copy Markdown
Contributor

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 exposes a named port metrics (port 9394) in the NVIDIA device plugin daemonset and updates the monitor service's targetPort to reference this named port. The reviewer noted that changing targetPort to a named port could break metrics collection for other daemonsets (such as Hygon DCU or Cambricon MLU) that share this service but do not have the named port declared. It is recommended to revert targetPort to the numeric value 9394 to maintain compatibility.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread charts/hami/templates/device-plugin/monitorservice.yaml Outdated
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 59.05% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread charts/hami/templates/device-plugin/daemonsetnvidia.yaml
@ntheanh201
ntheanh201 force-pushed the fix/vgpu-monitor-port branch from aea16ae to 9621c73 Compare July 1, 2026 03:31
Declare the named 'metrics' containerPort (9394) on the vgpu-monitor
container. The monitor already serves Prometheus metrics on :9394, but the
port was never declared on the container spec, so it was not discoverable
(e.g. for PodMonitor/ServiceMonitor selectors referencing a named port).

The monitor Service keeps a numeric targetPort (9394) so it continues to
route to any selected pod serving on that port, without requiring every
selected pod to declare a container port of that name.

Signed-off-by: The Anh Nguyen <ntheanh201@gmail.com>
@mesutoezdil

Copy link
Copy Markdown
Contributor

/lgtm

@archlitchi archlitchi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@hami-robot

hami-robot Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: archlitchi, ntheanh201

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

The pull request process is described here

Details 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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants