1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00
Commit graph

232 commits

Author SHA1 Message Date
Markus Lehtonen
c52d01a6cb source/memory: refactor numa detection into a separate func 2019-03-19 09:38:30 +02:00
Markus Lehtonen
e866b6ee1c Implement RDT detection in go
Get rid of the dependency on intel-cmt-cat library and rdt helper
binaries written in C. Significantly simplifies the build procedure.

Implements minimal support (in assembler) for getting the raw data from
the CPUID instruction. Also, implement a stub so that the code works on
other architectures than amd64, too.
2019-02-22 22:23:13 +02:00
Markus Lehtonen
eeed6d14b1 Support non-binary kconfig options in kernel feature source
Discover other than bool or tristate kconfig options, too. For bool and
tristate the node label is still binary (i.e. set to "true" if the
kconfig option has been enabled). For other kconfig types (e.g. string
or int) the value of the label directly corresponds to the value of the
kconfig flag, e.g. "32", "elf64-x86-64" etc.
2019-02-22 22:15:25 +02:00
Markus Lehtonen
af22702b93 source/system: advertise major and minor OS version
Add two new attributes 'VERSION_ID.major' and 'VERSION_ID.minor' to the
os_release feature. These represent the first two components of
the OS version (version components are assumed to be separated by a
dot). E.g. if VERSION_ID would be 1.2.rc3 major and minor versions would
be 1 and 2, respectively:
  feature.node.kubernetes.io/system-os_release.VERSION_ID=1.2.rc3
  feature.node.kubernetes.io/system-os_release.VERSION_ID.major=1
  feature.node.kubernetes.io/system-os_release.VERSION_ID.minor=2

The version components must be purely numerical in order for them to be
advertised. This way they can be fully (and reliably) utilized in
nodeAffinity, including relative (Gt and Lt) operators.
2019-02-13 20:45:13 +02:00
Markus Lehtonen
e8249e6fa3 Move selinux detection to kernel feature source
Remove the 'selinux' feature source and move the functionality under the
'kernel' feature source. The selinux feature label is changed to
  feature.node.kubernetes.io/selinux.enabled

The selinux feature source was rather narrow in scope, and, the sole
feature it advertised naturally falls under the kernel feature source.
2019-01-03 10:08:28 +02:00
Markus Lehtonen
da2cb07c64 Implement cpu feature source
Currently, it only detects one feature, i.e. hardware multithreading
(such as Intel hyper-threading technology). The corresponding feature
label is:
  feature.node.kubernetes.io/cpu-hardware_multithreading=true

However, this (architecture/platform dependent) feature is not detected
directly, and, the heuristics can be mislead. Detection works by
checking the thread siblings of each logical (and online) cpu in the
system. If any cpu has any thread siblings the feature label is set to
true. Thus, hardware multithreading could be effectively disabled e.g.
by putting all sibling cpus offline (even if the technology would be
enabled in hardware).
2018-12-07 16:58:09 +02:00
Markus Lehtonen
649d8a3ae1 Implement OS release detection
Implement new 'system' feature source. It now detects OS release
information from the os-release file, assumed to be available at
/host-etc/os-release. It currently creates two labels (assuming that the
corresponding fields are found in the os-release file), with example
values:
  feature.node.kubernetes.io/system-os_release.ID=opensuse
  feature.node.kubernetes.io/system-os_release.VERSION_ID=42.3

Also, update the template spec to mount /etc/os-release file from the
host inside the container.
2018-12-05 14:42:38 +02:00
Bin Lu
1ccd69e6e3 Add ARM64 support to cpuid
Signed-off-by: Bin Lu <bin.lu@arm.com>
2018-12-05 10:13:24 +02:00
Markus Lehtonen
47a97db35a Import from sigs.k8s.io/node-feature-discovery 2018-12-04 15:15:46 +02:00
Markus Lehtonen
4053010dd9 Make the kernel feature source configurable
Adding two config options:
- kernel config file to read
- kconfig options that are detected
2018-12-04 09:34:56 +02:00
Markus Lehtonen
ce129aef88 Implement kernel config detection
This implementation only detects kconfig options ("NO_HZ", "NO_HZ_IDLE",
"NO_HZ_FULL" and "PREEMPT"). The corresponding node labels will be
  node.alpha.kubernetes-incubator.io/nfd-kernel-config.<option name>

Currently, only bool and tristate (i.e. '=y' or '=m') kernel config
options are supported. Other kconfig types (e.g. string or int) are
simply ignored. If the kconfig flag is set to '=y' or '=m', the
corresponding node label will be present and it's value will be 'true'.
2018-12-04 09:34:56 +02:00
Markus Lehtonen
5af04ca3f6 source/local: allow full control of label name
Make it possible for the hooks to fully define the label name to be used
(i.e. without the '<hook name>-' prefix) by prefixing the printed
feature names with a slash ('/'). This makes it possible to e.g.
override labels create by other sources.

For example having the following output from a hook:
/override_source-override_bool
/override_source-override_value=my value

will translate into the following feature labels:
feature.node.kubernetes.io/override_source-override_bool = true
feature.node.kubernetes.io/override_source-override_value = my value
2018-11-30 11:51:41 +02:00
Markus Lehtonen
4b066ed815 source/local: support non-binary labels
Make the feature detector hooks, run by the 'local' feature source,
support non-binary label values. Hooks can advertise non-binary value by
using <name>=<value> format.

For example, /etc/kubernetes/node-feature-discovery/source.d/myhook
having the following stdout:
LABEL_1
LABEL_2=foobar

Would translate into the following labels:
feature.node.kubernetes.io/myhook-LABEL_1 = true
feature.node.kubernetes.io/myhook-LABEL_2 = foobar
2018-11-30 11:51:41 +02:00
Markus Lehtonen
a84b5c9d82 Support feature detector hooks
Implement a new feature source named 'local' whose only purpose is to
run feature source hooks found under
/etc/kubernetes/node-feature-discovery/source.d/ It tries to execute all
files found under the directory, in alphabetical order.

This feature source provides users a mechanism to implement custom
feature sources in a pluggable way, without modifying nfd source code or
Docker images.

The hooks are supposed to print all discovered features in stdout, one
feature per line. The output in stdout is used in the node label as is.
Full node label name will have the following format:
  feature.node.kubernetes.io/<hook name>-<feature name>
Stderr from the hooks is propagated to nfd log.
2018-11-30 11:51:41 +02:00
Markus Lehtonen
86947fc16b Implement kernel version detection
Add a new 'kernel' feature source, detecting the kernel version. The
kernel version is split into multiple labels in order to make this more
usable in label selectors. Kernel version in the format X.Y.Z-patch will
be presented as
  node.alpha.kubernetes-incubator.io/nfd-kernel-version.full=X.Y.Z-patch
  node.alpha.kubernetes-incubator.io/nfd-kernel-version.major=X
  node.alpha.kubernetes-incubator.io/nfd-kernel-version.minor=Y
  node.alpha.kubernetes-incubator.io/nfd-kernel-version.revision=Z

The '.full' label will always be avaiable. The other labels if these
components can be parsed from the kernel version number.
2018-10-10 13:21:49 +03: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
Markus Lehtonen
4fa7ae38e3 network: rename sriov labels
Introduce a new scheme where features may have logical sub-components.
Rename sriov labels from the network source according to the new
pattern:
  sriov            -> sriov.capable
  sriov-configured -> sriov.configured

Also, document this new labeling scheme in the README.

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
2018-10-03 15:25:58 +03:00
Rui Cao
4bab607b82 Fix typo: suppported -> supported
Signed-off-by: Rui Cao <ruicao@alauda.io>
2018-10-02 17:14:03 +03:00
Bin Lu
db929b878b Skip pstate detection on Arm
Signed-off-by: Bin Lu <bin.lu@arm.com>
2018-08-17 11:10:18 +03:00
Markus Lehtonen
175305b1ad Implement detection of IOMMU (#136) (#137)
* Arrange feature sources alphabetically

Just a cosmetic change, but, a small readability improvement.

* Implement detection of IOMMU (#136)

Add a new feature source, i.e. 'iommu', which detects if an IOMMU is
present and enabled in the kernel. The new node label is
  node.alpha.kubernetes-incubator.io/nfd-iommu-present
2018-07-24 08:24:45 -07:00
Olev Kartau
e984154090 Added more Intel RDT capability discovery: CMT,MBM,MBA (#120)
Added Memory Bandwith Allocation (MBA) capability discovery.
Refined RDT monitoring capability detection;
Cache Monitoring Technology (CMT) and
Memory Bandwidth Monitoring (MBM)
capabilities can be detected separately.
2018-05-24 16:49:00 -07:00
Naga Ravi Chaitanya Elluri
60de66fc03 Advertise selinux status by adding labels
This commit:
- enables node-feature-dicovery to advertise selinux status
  on the node by adding a label.

- update the template to mount /sys into the container, this is
  needed to know about the selinux status on the host

- adds selinux source for unit tests
2018-04-09 16:13:45 -04:00
Olev Kartau
00615be083 Add memory source and NUMA detection.
If multiple nodes are marked online in
/sys/devices/system/node/online, it's a sign of NUMA
architecture. Mark it using nfd-memory-numa label.
2018-03-29 09:43:42 +03:00
Olev Kartau
e22ae236cd Added nonrotational storage detection
This change adds feature source "storage".
Add label if any non-rotational block device is present in the node.
The label will be: nfd-storage-nonrotationaldisk=true
2018-03-27 14:30:27 +03:00
Markus Lehtonen
348f3a7f89 Remove hardcoding of nfd source path (#94)
* Make rdt-discovery buildable outside hardcoded path

Do not assume that nfd sources always reside under hardcoded directory
"/go/src/github.com/kubernetes-incubator/node-feature-discovery/". This
makes it possible e.g. to build nfd locally outside the Docker
container.

* Do not hardcode the path for RDT helper binaries

Utilize the standard PATH env variable, instead.
2018-03-16 09:56:35 -07:00
Olev Kartau
15559903a0 Improve GoReportCard metrics, both gofmt and golint (#90)
* Format main,fake,network go source to improve GoReportCard

Order of import changed in main.go and network.go,
missing ending newline added in fake.go

* Fixed simple golint suggestions in multiple files

Mostly about missing or incomplete comments
2018-03-05 07:51:47 -08:00
Markus Lehtonen
b999a1a6f4 Fix unit tests (#98)
* Update unit tests

Make the unit tests pass, again.

* Update project dependencies

* Enable unittests in travis
2018-03-01 10:49:57 -08:00
swatisehgal
41da99a435 Adding SR-IOV capability discovery to node-feature-discovery (#49)
* Adding SR-IOV capability discovery to node-feature-discovery

* SR-IOV capability discovery in NFD : code update after PR review
- using hostnetwork instead of volume mount in file node-feature-discovery-job.json.template
- iterating through network interfaces that are "up" in sources.go
- inserting logs in sources.go
- change in feature source name from "netid" to "network" in sources.go, README.md and main.go

*  Added code for labels sriov=true (sriov_totalvfs > 0) and sriov-configured=true (sriov_numvfs > 0)

* Code Refactored: Added Network package and network.go
2017-11-28 15:47:11 +01:00
Andy Xie
0ea8ff631e refactor sources to source pkg 2017-09-05 21:35:33 -07:00