1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-28 02:37:11 +00:00

Merge pull request #694 from marquiz/fixes/usb

source/usb: fix fallback to default label format
This commit is contained in:
Kubernetes Prow Robot 2021-12-10 05:49:10 -08:00 committed by GitHub
commit 73597f4cc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,10 +43,12 @@ func newDefaultConfig() *Config {
// By default these include classes where different accelerators are typically mapped:
// Video (0e), Miscellaneous (ef), Application Specific (fe), and Vendor Specific (ff).
DeviceClassWhitelist: []string{"0e", "ef", "fe", "ff"},
DeviceLabelFields: []string{"class", "vendor", "device"},
DeviceLabelFields: defaultDeviceLabelFields(),
}
}
func defaultDeviceLabelFields() []string { return []string{"class", "vendor", "device"} }
// usbSource implements the LabelSource and ConfigurableSource interfaces.
type usbSource struct {
config *Config
@ -110,7 +112,7 @@ func (s *usbSource) GetLabels() (source.FeatureLabels, error) {
}
if len(deviceLabelFields) == 0 {
klog.Warningf("no valid fields in deviceLabelFields defined, using the defaults")
deviceLabelFields = []string{"vendor", "device"}
deviceLabelFields = defaultDeviceLabelFields()
}
// Iterate over all device classes