feat: add HardwareDetector interface and measurement keys for NFD integration#482
Merged
mchmarny merged 6 commits intoNVIDIA:mainfrom Apr 3, 2026
Merged
Conversation
|
Welcome to AICR, @ArangoGutierrez! Thanks for your first pull request. Before review, please ensure:
A maintainer will review this soon. |
b420e88 to
3770f88
Compare
4e9a4a7 to
96d81fc
Compare
…Detector interface Add NFD API types dependency (sigs.k8s.io/node-feature-discovery/api/nfd@v0.18.3) for GPU hardware detection without driver dependency. New measurement keys: KeyGPUPresent, KeyDriverLoaded, KeyDetectionSource in pkg/measurement/types.go for NFD-based hardware detection results. New timeout: NFDDetectionTimeout (5s) in pkg/defaults/timeouts.go for local sysfs/procfs operations (PCI enumeration and kernel module listing). New interface: HardwareDetector with HardwareInfo type in pkg/collector/gpu/hardware.go for abstracting GPU hardware detection. PCI and NFD constants deferred to Task 1 when they are consumed. New tests: TestHardwareDetectorInterface validates interface contract with mock implementation. NFDDetectionTimeout added to TestTimeoutConstants. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
96d81fc to
be04d3e
Compare
The blank import of sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1 executes K8s scheme registration init() functions in every binary. The NFD dependency will be added in Task 1 when actual code uses it. Addresses reviewer feedback: critical finding. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Aligns the struct with the KeyGPUDetectionSource measurement key so implementations don't need to pass detection source out-of-band. Addresses reviewer feedback: important finding. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Adds 'detection failure' test case exercising wantErr=true with nil info. Adds early return after error check to prevent nil-pointer dereference. Adds DetectionSource field assertions to existing test cases. Addresses reviewer feedback: important finding. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
KeyDriverLoaded -> KeyGPUDriverLoaded KeyDetectionSource -> KeyGPUDetectionSource String values unchanged. Aligns with existing KeyGPUDriver, KeyGPUModel, KeyGPUCount naming convention. Addresses reviewer feedback: minor finding. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Task 0 of NFD Snapshot Enrichment (Track A).
Adds shared infrastructure for day-0 GPU hardware detection:
gpu-present,driver-loaded,detection-source(withKeyGPU*prefix convention)NFDDetectionTimeout(5s)HardwareDetectorinterface andHardwareInfotype (includingDetectionSourcefield)Note
The NFD Go dependency (
sigs.k8s.io/node-feature-discovery) and PCI/NFD constants(vendor ID, device classes, source names) are deferred to Task 1 when code imports
NFD packages.
go mod tidyremoves unused imports, andgolangci-lintflagsunused constants, so both are best added alongside their first consumer.
Testing
go build ./...passes-race