1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-15 17:50:49 +00:00
Commit graph

12 commits

Author SHA1 Message Date
Carlos Eduardo Arango Gutierrez
389a8f87cf
logging: start log messages with lower case
Standarize logs to be lower case.

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2021-03-01 10:07:21 -05:00
Markus Lehtonen
7da7fde8f6 nfd-worker: switch to klog
Greatly expands logging capabilities and flexibility with verbosity
options, among other things.
2021-02-25 16:10:43 +02:00
Markus Lehtonen
a2b9df5cd3 nfd-worker: rework configuration handling
Extend the FeatureSource interface with new methods for configuration
handling. This enables easier on-the fly reconfiguration of the
feature sources. Further, it simplifies adding config support to feature
sources in the future. Stub methods are added to sources that do not
currently have any configurability.

The patch fixes some (corner) cases with the overrides (--options)
handling, too:
- Overrides were not applied if config file was missing or its parsing
  failed
- Overrides for a certain source did not have effect if an empty config
  for the source was specified in the config file. This was caused by
  the first pass of parsing (config file) setting a nil pointer to the
  source-specific config, effectively detaching it from the main config.
  The second pass would then create a new instance of the source
  specific config, but, this was not visible in the feature source, of
  course.
2020-05-21 00:59:37 +03:00
Paul Mundt
c0ea69411b usb: Add support for USB device discovery
This builds on the PCI support to enable the discovery of USB devices.

This is primarily intended to be used for the discovery of Edge-based
heterogeneous accelerators that are connected via USB, such as the Coral
USB Accelerator and the Intel NCS2 - our main motivation for adding this
capability to NFD, and as part of our work in the SODALITE H2020
project.

USB devices may define their base class at either the device or
interface levels. In the case where no device class is set, the
per-device interfaces are enumerated instead. USB devices may
furthermore have multiple interfaces, which may or may not use the
identical class across each interface. We therefore report device
existence for each unique class definition to enable more fine-grained
labelling and node selection.

The default labelling format includes the class, vendor and device
(product) IDs, as follows:

	feature.node.kubernetes.io/usb-fe_1a6e_089a.present=true

As with PCI, a subset of device classes are whitelisted for matching.
By default, there are only a subset of device classes under which
accelerators tend to be mapped, which is used as the basis for
the whitelist. These are:

	- Video
	- Miscellaneous
	- Application Specific
	- Vendor Specific

For those interested in matching other classes, this may be extended
by using the UsbId rule provided through the custom source. A full
list of class codes is provided by the USB-IF at:

	https://www.usb.org/defined-class-codes

For the moment, owing to a lack of a demonstrable use case, neither
the subclass nor the protocol information are exposed. If this
becomes necessary, support for these attributes can be trivially
added.

Signed-off-by: Paul Mundt <paul.mundt@adaptant.io>
2020-05-20 16:18:39 +02:00
Adrian Chiris
a1a2429df1 Move PCI introspection logic to its own internal package
This will enable code reuse across sources while preventing
packages which are not under 'source' to import it.

subsequent commits will introduce the 'custom' source which
will use the logic.
2020-03-12 15:09:27 +02:00
Mikko Ylinen
24c3a98303 pci: add sriov.capable attribute
SR-IOV is a PCI attribute and also non-NIC PCI devices can have it. Therefore,
it is useful to label all PCI devices with that capability.

After this commit the following labels for Intel NICs are overlapping:
feature.node.kubernetes.io/pci-0200_8086.sriov.capable=true
feature.node.kubernetes.io/network-sriov.capable=true

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-02-18 20:09:32 +02:00
Markus Lehtonen
d4cb0e742b Use standard logger for all feature sources 2019-04-25 17:17:41 +03:00
Markus Lehtonen
47a97db35a Import from sigs.k8s.io/node-feature-discovery 2018-12-04 15:15:46 +02:00
Markus Lehtonen
56c2ab3d58 Support for non-binary labels
Make it possible to advertise also other than simple 'true' values for
feature labels.
2018-10-10 13:21:49 +03:00
Markus Lehtonen
b0fedab786 sources/pci: make device label format configurable
Add new config option for specifying the device label, i.e. the
<device-label> part in
    node.alpha.kubernetes-incubator.io/nfd-pci-<device label>.present

The option is a list of field names:
    "class"             PCI device class
    "vendor"            Vendor ID
    "device"            Device ID
    "subsystem_vendor"  Subsystem vendor ID
    "subsystem_device"  Subsystem device ID

E.g. the following command line flag can be used to use all of the
above:
  --options='{"sources": {"pci": {"deviceLabelFields": ["class", "vendor", "device", "subsystem_vendor", "subsystem_device"] } } }'
2018-10-10 12:36:20 +03:00
Markus Lehtonen
b0d0797936 Add config support for the pci feature source
User can now configure the list of device classes to detect, either via
a configuration file or by using the --options command line flag.

An example of a command line flag to detect all network controllers and
("main class 0x02) and VGA display controllers ("main" class 0x03 and
subclass 0x00) would be:
  --options='{"sources": {"pci": {"deviceClassWhitelist": ["02", "0300"] } } }'
2018-10-10 12:36:20 +03:00
Markus Lehtonen
74d6993e9b Implement PCI feature source
This feature source detects the presence of PCI devices. At the moment,
it only advertises GPUs and accelerator cards, i.e. device classes 0x03,
0x0b40 and 0x12.

The label format is:
  node.alpha.kubernetes-incubator.io/nfd-pci-<device label>.present
where <device label> is composed of raw PCI IDs:
  <class id>_<vendor id>
2018-10-10 12:36:20 +03:00