Skip to content
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

Plugin mechanism for customer-specific labels #144

Closed
marquiz opened this issue Jul 12, 2018 · 9 comments
Closed

Plugin mechanism for customer-specific labels #144

marquiz opened this issue Jul 12, 2018 · 9 comments

Comments

@marquiz
Copy link
Contributor

marquiz commented Jul 12, 2018

What: provide a way for customers to write their own feature detectors, creating custom labels.

Originally, I thought, it would be sufficient to implement custom feature sources as user-specific modules under source/ directory in nfd source code. The reasoning behind this idea was that the source modules and their API to "nfd core" are simple, so writing and maintaining a custom plugin would not be too cumbersome. However, this would effectively be forking nfd, requiring maintenance of your own code base and also building and using custom Docker images.

So, I was thinking about providing some relatively simple mechanism to have custom feature detectors, without the need to fork the code or use custom Docker images.

The first, obvious, idea would be to use hooks. E.g. look under /etc/kubernetes/node-feature-discovery/source.d/ and run all executable binaries from there. The hooks would return the detected features to stdout and have logging to stderr.

E.g.
running /etc/kubernetes/node-feature-discovery/source.d/my-source would have stdout output:

FEATURE_1
FEATURE_2

which, in turn, would cause nfd to create labels

node.alpha.kubernetes-incubator.io/nfd-my-source-FEATURE_1=true
node.alpha.kubernetes-incubator.io/nfd-my-source-FEATURE_2=true

This could be easily extended to non-binary labels, too

@lmdaly
Copy link

lmdaly commented Jul 12, 2018

+1 on a pluggable mechanism for specific features that are not acceptable for upstream NFD.

@marquiz
Copy link
Contributor Author

marquiz commented Jul 18, 2018

An initial version implemented in PR #148

@MarSik
Copy link

MarSik commented Nov 14, 2018

The proposed label name seems very limiting. The custom hooks might be used to detect functionality that has been provided using manual labels so far or that integrates with other existing tools and the proposed format would not allow the use of expected label names.

I would rather let the hook scripts return the full label names to make the label independent on the project/script reporting it completely. That way the hooks can even replace a detection method that might not be appropriate for some environments or hosts and still provide the same feature labels.

@marquiz
Copy link
Contributor Author

marquiz commented Nov 15, 2018

NFD is supposed to advertise node features, thus, I would restrict the hook to nfd labels, and not give control over the label namespace. This also relates to re-labeling which has been discussed in #176. I think it's an important feature of NFD that it is able to remove out-of-date/incorrect labels. NFD wouldn't be able to remove any old labels if the hooks had full control over the label name.

Replacing or extending existing feature sources is probably a valid use case, though. So, dropping the feature source part, i.e. local, from the label name in the current implementation makes sense.

@MarSik
Copy link

MarSik commented Nov 22, 2018

I agree, lets limit that to the feature.node.kubernetes.io/ namespace and drop the local prefix. That is completely sufficient for our use cases and sounds right to me. Thanks for listening to our wishes :)

@marquiz
Copy link
Contributor Author

marquiz commented Nov 22, 2018

I'll rebase this changes after the repo migration has been completed, and, the label namespace change has been merged.

@MarSik
Copy link

MarSik commented Nov 22, 2018

That is awesome news, thank you.

@marquiz
Copy link
Contributor Author

marquiz commented Nov 30, 2018

Updated version submitted. See PR #148 for details

@marquiz
Copy link
Contributor Author

marquiz commented Nov 30, 2018

#148 merged into master

@marquiz marquiz closed this as completed Nov 30, 2018
@marquiz marquiz mentioned this issue Dec 12, 2018
10 tasks
ArangoGutierrez pushed a commit to ArangoGutierrez/node-feature-discovery that referenced this issue Nov 18, 2020
Version 0.4.0

Node-feature-discovery was migrated into a new repository under the
kubernetes-sigs organization in Github (kubernetes-sigs#175). Related to the migration,
the final container image registry/repo hasn't been dediced yet (kubernetes-sigs#177) –
for this release we still use the old repo.

Major changes
- Split NFD into client and server (kubernetes-sigs#209)
- Changes in labels:
  - NFD label namespace was changed to 'feature.node.kubernetes.io/' (kubernetes-sigs#176)
    - 'nfd-' prefix was dropped from all feature labels
    - NFD version label
      (feature.node.kubernetes.io/node-feature-discovery.version) was
      replaced by an annotation (nfd.node.kubernetes.io/version)
  - network SRIOV labels were changed (kubernetes-sigs#173):
    - 'network-sriov' -> 'network-sriov.capable'
    - 'network-sriov-configured' -> 'network-sriov.configured'
  - selinux detection was moved to kernel feature source
    - 'selinux' -> 'kernel-selinux.enabled'
  - cpuid, pstate and RDT labels moved under cpu feature source (kubernetes-sigs#217)
    - 'cpuid-<cpuid flag>' -> 'cpu-cpuid.<cpuid flag>'
    - 'pstate-turbo' -> 'cpu-pstate.turbo'
    - 'rdt-<rdt feature>' -> 'cpu-rdt.<rdt feature>'
- Support for config file (kubernetes-sigs#169). Currently with three configurable
  feature sources i.e. cpu (kubernetes-sigs#224), kernel (kubernetes-sigs#157) and pci (kubernetes-sigs#168)
- Support for non-binary labels, with arbitrary values other than plain
  'true'
- PCI device detection (kubernetes-sigs#168)
- Kernel version detection (kubernetes-sigs#157)
- Kernel config option detection (kubernetes-sigs#146)
- Support for custom feature-detector hooks (kubernetes-sigs#144)
- Support OS version detection (kubernetes-sigs#149, kubernetes-sigs#211)
- Detection of hardware multithreading, such as Intel Hyper-Threading
  Technology (kubernetes-sigs#147)
- Arm64 support for CPUID detection (kubernetes-sigs#194)
- Validation of feature label names and values (kubernetes-sigs#199, kubernetes-sigs#219)
- Detection of NVDIMM devices (kubernetes-sigs#214)
- Get labels by reading from file in 'local' source (kubernetes-sigs#228)
- Detection of Intel SST-BF (Speed Select Technology - Base Frequency) (kubernetes-sigs#235)
- Make it possible to create feature labels in non-default namespace
  (kubernetes-sigs#231). Currently possible for using the local source (hooks and files).

Miscellaneous
- Template specs converted from json to yaml
- Documentation updates and fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants