Skip to content

compute-domain: write daemon config files after their prerequisites - #1637

Open
thc1006 wants to merge 1 commit into
kubernetes-sigs:mainfrom
thc1006:compute-domain-daemon-prepare-order
Open

thc1006 wants to merge 1 commit into
kubernetes-sigs:mainfrom
thc1006:compute-domain-daemon-prepare-order

Conversation

@thc1006

@thc1006 thc1006 commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

What type of PR is this?

/kind bug

What this PR does / why we need it:

applyComputeDomainDaemonConfig wrote the daemon's config directory and template before it looked up the ComputeDomain and, on nodes with a clique ID, parsed the fabric-imex-mgmt capability. A claim for a ComputeDomain the informer did not know left the directory behind on every attempt, and only the periodic cleanup removed it.

The files are now written after both steps succeed.

Which issue(s) this PR is related to:

Fixes #1348

Special notes for your reviewer:

On main the first new test fails. With the daemon template at its fixed path it fails with directory ".../cd-uid" exists. Without it, as in CI, main returns the template error instead of the expected one. The second makes Prepare fail on purpose, on nodes with and without a clique ID, so it fails if Prepare is skipped on either or its error is dropped. Both read the nvcap and /proc/devices from temp files, not from the host.

make test and make golangci-lint pass. I have not run this on MNNVL hardware.

This PR was written with the assistance of generative AI.

Does this PR introduce a user-facing change?

NONE

Additional documentation (design docs, usage docs, etc.):


Checklist

  • make check test passes locally
  • make check-generate passes if api/ changed (CRDs, deepcopy, informers, listers, clientset)
  • make check-modules passes if go.mod / go.sum changed
  • Tests added or updated for the change
  • Helm chart (deployments/helm) updated if flags, RBAC, or defaults changed

@kubernetes-prow kubernetes-prow Bot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. labels Nov 15, 2026
@netlify

netlify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

👷 Deploy request for dra-driver-nvidia-gpu pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 537ea9a

@kubernetes-prow
kubernetes-prow Bot requested a review from jgehrcke November 15, 2026 01:07
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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

@kubernetes-prow
kubernetes-prow Bot requested a review from tariq1890 November 15, 2026 01:07
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 15, 2026
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The daemon config path now generates common and, when supported, IMEX-management CDI edits before calling Prepare. New tests check directory behavior when the ComputeDomain is missing, nvcap device information cannot be parsed, or no IMEX clique is configured.

Severity of issue fixed: Low

Merge Risk: Minimal · up to 1c180

This change writes daemon config files only after the ComputeDomain lookup and capability parsing succeed. That avoids leaving stray directories when a request fails. The risk is minimal, and nodes without a clique ID still receive their files.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: daemon config files are now written after their prerequisites (ComputeDomain lookup and clique ID capability parsing). It matches the raw summary and the objectives, a…
Linked Issues check Passed Requirement from #1348: resolve the ComputeDomain and other fallible, side-effect-free prerequisites before the filesystem write, so Prepare (MkdirAll and WriteFile) runs last. Evidence: the PR summar…
Out of Scope Changes check Passed Changes are limited to cmd/compute-domain-kubelet-plugin/device_state.go (reordering edit generation before Prepare in applyComputeDomainDaemonConfig) and device_state_test.go (new tests and helpers f…
Description check Passed The description states the bug (applyComputeDomainDaemonConfig wrote the config directory and template before the ComputeDomain lookup and fabric-imex-mgmt capability parsing, leaving the directory be…
Full details: Title check

Explanation

The title names the main change: daemon config files are now written after their prerequisites (ComputeDomain lookup and clique ID capability parsing). It matches the raw summary and the objectives, and it is specific enough for a teammate scanning history.

Full details: Linked Issues check

Explanation

Requirement from #1348: resolve the ComputeDomain and other fallible, side-effect-free prerequisites before the filesystem write, so Prepare (MkdirAll and WriteFile) runs last. Evidence: the PR summary states that applyComputeDomainDaemonConfig now gathers common CDI edits (which call GetComputeDomain per #1348) and, on nodes with a clique ID, the IMEX-management device edits, before calling Prepare. The PR description states the files are written only after both steps succeed. The new test for a missing ComputeDomain checks that the domain directory is absent, and the test for an unparsable fabric-imex-mgmt nvcap checks the same. Nodes without a clique ID still get the directory (second test). Limits: the device_state.go diff could not be read (changed blobs missing from checkout), and the function body was not directly inspected. The verdict relies on the summary and the test descriptions. The template path is not exercised by tests, so template content is not verified. DomainID path validation from #1346 is correctly excluded. Stack evidence was unavailable; this is a single-PR assessment.

Full details: Out of Scope Changes check

Explanation

Changes are limited to cmd/compute-domain-kubelet-plugin/device_state.go (reordering edit generation before Prepare in applyComputeDomainDaemonConfig) and device_state_test.go (new tests and helpers for the daemon-config path). Both directly implement the #1348 ordering requirement and its tests. No unrelated files are listed in the summary. The direct diff could not be read, so line-level confirmation is limited to the summary and PR description.

Full details: Description check

Explanation

The description states the bug (applyComputeDomainDaemonConfig wrote the config directory and template before the ComputeDomain lookup and fabric-imex-mgmt capability parsing, leaving the directory behind on failure), the fix (files are written after both steps succeed), the linked issue #1348, and the new tests with their expected failure modes on main. It matches the changeset and the linked objectives, so it is not off-topic or vague.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e775fdb and 1c18061.

Files selected for processing: 2

  • cmd/compute-domain-kubelet-plugin/device_state.go
  • cmd/compute-domain-kubelet-plugin/device_state_test.go

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

@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 15, 2026
@thc1006
thc1006 force-pushed the compute-domain-daemon-prepare-order branch from 1c18061 to 58f8c58 Compare November 15, 2026 04:42
@kubernetes-prow kubernetes-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 15, 2026
@thc1006
thc1006 force-pushed the compute-domain-daemon-prepare-order branch from 58f8c58 to 6cfa927 Compare November 20, 2026 14:00
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 21, 2026
applyComputeDomainDaemonConfig created the daemon's config directory and
template before it looked up the ComputeDomain and, on nodes with a clique
ID, parsed the fabric-imex-mgmt capability. When either step failed, the
directory stayed behind. For a ComputeDomain the informer did not know, it
stayed until the periodic cleanup removed it.

Do both steps first and write the files last, so these failures leave no
directory. The files are still written on nodes without a clique ID.

Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
@thc1006
thc1006 force-pushed the compute-domain-daemon-prepare-order branch from 6cfa927 to 537ea9a Compare November 25, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug]: compute-domain daemon writes config files before verifying the ComputeDomain exists

1 participant