Skip to content

Commit

Permalink
Merge pull request #1326 from marquiz/devel/docs-hooks
Browse files Browse the repository at this point in the history
docs: demote hooks in the customization guide
  • Loading branch information
k8s-ci-robot authored Sep 4, 2023
2 parents 19520c0 + cbd2c2f commit 8a1facd
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions docs/usage/customization-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ labeling:
- [`NodeFeatureRule`](#nodefeaturerule-custom-resource) objects provide a way to
deploy custom labeling rules via the Kubernetes API.
- [`local`](#local-feature-source) feature source of nfd-worker creates
labels by executing hooks and reading files.
labels by reading text files and executing hooks.
- [`custom`](#custom-feature-source) feature source of nfd-worker creates
labels based on user-specified rules.

Expand Down Expand Up @@ -226,9 +226,9 @@ point for external feature detectors. It provides a mechanism for pluggable
extensions, allowing the creation of new user-specific features and even
overriding built-in labels.

The `local` feature source has two methods for detecting features, hooks and
feature files. The features discovered by the `local` source can further be
used in label rules specified in
The `local` feature source has two methods for detecting features, feature
files and hooks (deprecated). The features discovered by the `local` source can
further be used in label rules specified in
[`NodeFeatureRule`](#nodefeaturerule-custom-resource) objects and the
[`custom`](#custom-feature-source) feature source.

Expand All @@ -238,13 +238,13 @@ used in label rules specified in
> atomically create/update the original file by doing a filesystem move
> operation.

### A hook example
### An example

Consider a shell script
Consider a plaintext file
`/etc/kubernetes/node-feature-discovery/features.d/my-features`
having the following contents (or alternatively a shell script
`/etc/kubernetes/node-feature-discovery/source.d/my-hook.sh` having the
following stdout output, or alternatively, a plaintext file
`/etc/kubernetes/node-feature-discovery/features.d/my-features` having the
following contents:
following stdout output):

```plaintext
my-feature.1
Expand All @@ -260,6 +260,12 @@ feature.node.kubernetes.io/my-feature.2: "myvalue"
my.namespace/my-feature.3: "456"
```

### Feature files

The `local` source reads files found in
`/etc/kubernetes/node-feature-discovery/features.d/`. File content is parsed
and translated into node labels, see the [input format below](#input-format).

### Hooks

**DEPRECATED** The `local` source executes hooks found in
Expand Down Expand Up @@ -295,11 +301,6 @@ sources:
> provides backwards-compatibility with older NFD versions by including a more
> expanded environment, supporting bash and perl runtimes.

### Feature files

The `local` source reads files found in
`/etc/kubernetes/node-feature-discovery/features.d/`.

### Input format

The hook stdout and feature files are expected to contain features in simple
Expand All @@ -325,13 +326,13 @@ from the host available inside the nfd-worker container.

#### Injecting labels from other pods

One use case for the hooks and/or feature files is detecting features in other
One use case for the feature files and hooks is detecting features in other
Pods outside NFD, e.g. in Kubernetes device plugins. By using the same
`hostPath` mounts for `/etc/kubernetes/node-feature-discovery/source.d/` and
`/etc/kubernetes/node-feature-discovery/features.d/` in the side-car (e.g.
device plugin) creates a shared area for deploying hooks and feature files to
NFD. NFD will periodically scan the directories and run any hooks and read any
feature files it finds.
device plugin) creates a shared area for deploying feature files and hooks to
NFD. NFD periodically scans the directories and reads any feature files and
runs any hooks it finds.

## Custom feature source

Expand Down Expand Up @@ -740,7 +741,7 @@ The following features are available for matching:
| | | **`major`** | int | First component of the kernel version (e.g. ‘4')
| | | **`minor`** | int | Second component of the kernel version (e.g. ‘5')
| | | **`revision`** | int | Third component of the kernel version (e.g. ‘6')
| **`local.label`** | attribute | | | Features from hooks and feature files, i.e. labels from the [*local* feature source](#local-feature-source)
| **`local.label`** | attribute | | | Features feature files and hooks, i.e. labels from the [*local* feature source](#local-feature-source)
| | | **`<label-name>`** | string | Label `<label-name>` created by the local feature source, value equals the value of the label
| **`memory.nv`** | instance | | | NVDIMM devices present in the system
| | | **`<sysfs-attribute>`** | string | Value of the sysfs device attribute, available attributes: `devtype`, `mode`
Expand Down

0 comments on commit 8a1facd

Please sign in to comment.