Skip to content

fix(dcgm-exporter): enable hostNetwork for a host DCGM set through dcgmExporter.env - #3092

Open
blacksoxx wants to merge 1 commit into
NVIDIA:mainfrom
blacksoxx:fix-dcgm-exporter-host-dcgm-hostnetwork
Open

blacksoxx wants to merge 1 commit into
NVIDIA:mainfrom
blacksoxx:fix-dcgm-exporter-host-dcgm-hostnetwork

Conversation

@blacksoxx

Copy link
Copy Markdown

Description

When dcgm.enabled is false, the exporter needs hostNetwork to reach a DCGM host engine on localhost. The check read DCGM_REMOTE_HOSTENGINE_INFO from the container before dcgmExporter.env was applied, so a value set there was never seen. 54c270c moved the user env to the end of TransformDCGMExporter and left the check where it was.

The check now runs after the user env loop. The nvidia-dcgm:5555 default for an operator-managed DCGM stays where it is, so a user value still overrides it.

Fixes #3091

Checklist

  • No secrets, sensitive information, or unrelated changes
  • Lint checks passing (make lint) (ran golangci-lint run ./controllers/...: 0 issues, and gofmt -s -l controllers/: clean)
  • Generated assets in-sync (make validate-generated-assets) (not run; no API or generated files changed)
  • Go mod artifacts in-sync (make validate-modules) (not run; no dependency changes)
  • Test cases are added for new code paths

Testing

New case "transform dcgm exporter with dcgm running on the host set only through dcgmExporter env" in TestTransformDCGMExporter supplies the variable only through the ClusterPolicy. It fails on main and passes with this change. go test ./controllers/ passes (Go 1.27.2, macOS arm64). Not tested on a cluster.

…gmExporter.env

The localhost check for DCGM running on the host reads
DCGM_REMOTE_HOSTENGINE_INFO from the container before the user env is
applied, so the value from dcgmExporter.env is never seen and the
exporter stays on the pod network. Check after the user env instead.

Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>
@blacksoxx
blacksoxx requested a review from a team as a code owner October 19, 2026 15:30
@copy-pr-bot

copy-pr-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/gpu-operator/.coderabbit.yaml
  • Review profile: QUIET
  • Plan: Enterprise
  • Run ID: 0288d93b-69ca-48c8-ba8d-4eb7288a5296
📥 Commits

Reviewing files that changed from the base of the PR and between dbb11e8 and a100539.

📒 Files selected for processing: 2
  • controllers/object_controls.go
  • controllers/transforms_test.go

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Walkthrough

When DCGM is disabled, TransformDCGMExporter now checks the remote hostengine address after applying configured exporter environment variables. If the value starts with localhost, the transform enables host networking and sets DNSClusterFirstWithHostNet. A test covers this configuration.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to a1005

The transform now applies the configured hostengine address before choosing pod networking, and the added test covers the localhost case. No concrete merge-blocking risk remains.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

No deployments
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.

[Bug]: dcgm-exporter no longer gets hostNetwork when a host DCGM is set through dcgmExporter.env

1 participant