-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
source: implement FeatureSource interface #604
source: implement FeatureSource interface #604
Conversation
f5b245c
to
7ebb099
Compare
7ebb099
to
b1073ef
Compare
b1073ef
to
1facc87
Compare
Rebased. Depends on #642 |
1facc87
to
157fff1
Compare
/unhold |
157fff1
to
afd6b9b
Compare
/assign @zvonkok @ArangoGutierrez |
@marquiz This fails for me:
|
I think this comes from line 139 in kernel.go. When SELinux is not enabled there is no entry added. |
Less error prone, as no chance for a nil pointer dereference.
Separate feature discovery and creation of feature labels in the kernel source. Move kernelutils from source/internal back to the source/kernel package. Change the kconfig custom rule to rely on the FeatureSource interface (GetFeatures()) of the kernel source. Also, add minimalist unit test.
Convert the cpu source to do feature discovery and creation of feature labels separately. Move cpuidutils from source/internal to the source/cpu package. Change the cpuid custom rule to utilize GetFeatures of the cpu source. Also, add minimalist unit test.
Separate feature discovery and creation of feature labels in the pci source. Move pci_utils from source/internal to the source/pci package. Change the implementation of the PciID custom rule to utilize the FeatureSource interface of the pci source. Also, add minimalist unit test.
Separate feature discovery and creation of feature labels in the usb source. Move usb_utils from source/internal to the source/usb package. Change the implementation of the UsbID custom rule to utilize the FeatureSource interface of the usb source. Also, add minimalist unit test.
Move the functionality responsible for detection of loeaded kernel modules from source/custom over to the source/kernel package. Add a new "loadedmodule" raw feature to the kernel source to store this information. Change loadedKmod custom rule to utilize kernel source.
Separate feature discovery and creation of feature labels in the system source. Also, change the implementation of the nodeName custom rule to utilize the FeatureSource interface of the system source. Also, add minimalist unit test.
Separate feature discovery (i.e. running hooks and reading feature files) and creation of feature labels in the local source. Also, add minimalist unit test.
afd6b9b
to
a91f332
Compare
OK, this should be fixed, now. Fixed by reverting part of my earlier internal api change. I also added simple unit tests to the feature sources to avoid this. |
e2e-test works on Minikube 1.22 Ran 2 of 230 Specs in 24.488 seconds
SUCCESS! -- 2 Passed | 0 Failed | 0 Pending | 228 Skipped
--- PASS: TestE2E (24.51s)
PASS
ok sigs.k8s.io/node-feature-discovery/test/e2e 24.543s test go test ./cmd/... ./pkg/... ./source/...
? sigs.k8s.io/node-feature-discovery/cmd/nfd-master [no test files]
ok sigs.k8s.io/node-feature-discovery/cmd/nfd-topology-updater (cached)
ok sigs.k8s.io/node-feature-discovery/cmd/nfd-worker 0.012s
? sigs.k8s.io/node-feature-discovery/pkg/api/feature [no test files]
? sigs.k8s.io/node-feature-discovery/pkg/apihelper [no test files]
? sigs.k8s.io/node-feature-discovery/pkg/cpuid [no test files]
ok sigs.k8s.io/node-feature-discovery/pkg/kubeconf (cached)
? sigs.k8s.io/node-feature-discovery/pkg/labeler [no test files]
? sigs.k8s.io/node-feature-discovery/pkg/nfd-client [no test files]
ok sigs.k8s.io/node-feature-discovery/pkg/nfd-client/topology-updater (cached)
ok sigs.k8s.io/node-feature-discovery/pkg/nfd-client/worker 3.093s
ok sigs.k8s.io/node-feature-discovery/pkg/nfd-master (cached)
? sigs.k8s.io/node-feature-discovery/pkg/podres [no test files]
ok sigs.k8s.io/node-feature-discovery/pkg/resourcemonitor (cached)
? sigs.k8s.io/node-feature-discovery/pkg/topologypolicy [no test files]
? sigs.k8s.io/node-feature-discovery/pkg/topologyupdater [no test files]
ok sigs.k8s.io/node-feature-discovery/pkg/utils (cached)
? sigs.k8s.io/node-feature-discovery/pkg/version [no test files]
ok sigs.k8s.io/node-feature-discovery/source 0.033s
ok sigs.k8s.io/node-feature-discovery/source/cpu 0.034s
? sigs.k8s.io/node-feature-discovery/source/custom [no test files]
? sigs.k8s.io/node-feature-discovery/source/custom/rules [no test files]
? sigs.k8s.io/node-feature-discovery/source/fake [no test files] ? sigs.k8s.io/node-feature-discovery/source/iommu [no test files]
ok sigs.k8s.io/node-feature-discovery/source/kernel 0.038s
ok sigs.k8s.io/node-feature-discovery/source/local 0.030s
? sigs.k8s.io/node-feature-discovery/source/memory [no test files]
? sigs.k8s.io/node-feature-discovery/source/network [no test files]
ok sigs.k8s.io/node-feature-discovery/source/pci 0.007s
? sigs.k8s.io/node-feature-discovery/source/storage [no test files]
ok sigs.k8s.io/node-feature-discovery/source/system 0.004s
ok sigs.k8s.io/node-feature-discovery/source/usb 0.004s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ArangoGutierrez, marquiz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Convert the
cpu
,kernel
,pci
,usb
,system
,custom
andlocal
sources to implement theFeatureSource
interface, i.e. do feature discovery and creation of feature labels separately.Changes the related custom rules to utilize
GetFeatures()
method of the feature sources.Also moves different "utils" from
source/internal
to the respective sources.This PR is split from #464, to make review easier. It demonstrates usage of the new
FeatureSource
interface with some of the sources. Other sources will be converted in future PRs.