Skip to content

Commit 62f4edd

Browse files
Drop support for hooks
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent 65b5e0c commit 62f4edd

File tree

10 files changed

+19
-234
lines changed

10 files changed

+19
-234
lines changed

deployment/components/common/worker-mounts.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
- name: host-lib
2020
hostPath:
2121
path: "/lib"
22-
- name: source-d
23-
hostPath:
24-
path: "/etc/kubernetes/node-feature-discovery/source.d/"
2522
- name: features-d
2623
hostPath:
2724
path: "/etc/kubernetes/node-feature-discovery/features.d/"
@@ -50,9 +47,6 @@
5047
- name: host-lib
5148
mountPath: "/host-lib"
5249
readOnly: true
53-
- name: source-d
54-
mountPath: "/etc/kubernetes/node-feature-discovery/source.d/"
55-
readOnly: true
5650
- name: features-d
5751
mountPath: "/etc/kubernetes/node-feature-discovery/features.d/"
5852
readOnly: true

deployment/components/worker-config/nfd-worker.conf.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@
7777
# - "class"
7878
# - "vendor"
7979
# - "device"
80-
# local:
81-
# hooksEnabled: false
8280
# custom:
8381
# # The following feature demonstrates the capabilities of the matchFeatures
8482
# - name: "my custom rule"

deployment/helm/node-feature-discovery/templates/worker.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ spec:
141141
mountPath: "/host-usr/src"
142142
readOnly: true
143143
{{- end }}
144-
- name: source-d
145-
mountPath: "/etc/kubernetes/node-feature-discovery/source.d/"
146-
readOnly: true
147144
- name: features-d
148145
mountPath: "/etc/kubernetes/node-feature-discovery/features.d/"
149146
readOnly: true
@@ -174,9 +171,6 @@ spec:
174171
hostPath:
175172
path: "/usr/src"
176173
{{- end }}
177-
- name: source-d
178-
hostPath:
179-
path: "/etc/kubernetes/node-feature-discovery/source.d/"
180174
- name: features-d
181175
hostPath:
182176
path: "/etc/kubernetes/node-feature-discovery/features.d/"

deployment/helm/node-feature-discovery/values.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ worker:
255255
# - "class"
256256
# - "vendor"
257257
# - "device"
258-
# local:
259-
# hooksEnabled: false
260258
# custom:
261259
# # The following feature demonstrates the capabilities of the matchFeatures
262260
# - name: "my custom rule"

docs/deployment/image-variants.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ For backwards compatibility a container image tag with suffix `-minimal`
2424
## Full
2525

2626
This image is based on [debian:bookworm-slim](https://hub.docker.com/_/debian)
27-
and contains a full Linux system for running shell-based nfd-worker hooks and
28-
doing live debugging and diagnosis of the NFD images.
27+
and contains a full Linux system for doing live debugging and diagnosis
28+
of the NFD images.
2929

3030
The container image tag has suffix `-full`
3131
(e.g. `{{ site.container_image }}-full`).

docs/get-started/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Feature discovery is divided into domain-specific feature sources:
7171
- System
7272
- USB
7373
- Custom (rule-based custom features)
74-
- Local (hooks for user-specific features)
74+
- Local (features files)
7575

7676
Each feature source is responsible for detecting a set of features which. in
7777
turn, are turned into node feature labels. Feature labels are prefixed with

docs/reference/worker-configuration-reference.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -304,32 +304,6 @@ sources:
304304

305305
### sources.local
306306

307-
### sources.local.hooksEnabled
308-
309-
**DEPRECATED**: Hooks are DEPRECATED since v0.12.0 release and support (and
310-
this configuration option) will be removed in NFD v0.17. Use
311-
[feature files](../usage//customization-guide.md#feature-files) instead.
312-
313-
Configuration option to disable/enable hooks execution. Disabled by default.
314-
315-
> **NOTE:** The default NFD container image only supports statically linked
316-
> binaries. Use the [full](../deployment/image-variants.md#full) image variant
317-
> for a slightly more extensive environment that additionally supports bash and
318-
> perl runtimes.
319-
320-
GitHub tracking issue:
321-
[Drop support for hooks (#856)](https://github.com/kubernetes-sigs/node-feature-discovery/issues/856).
322-
323-
Default: false
324-
325-
Example:
326-
327-
```yaml
328-
sources:
329-
local:
330-
hooksEnabled: true
331-
```
332-
333307
### sources.pci
334308

335309
#### sources.pci.deviceClassWhitelist

docs/usage/customization-guide.md

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ labeling:
2626
- [`NodeFeatureRule`](#nodefeaturerule-custom-resource) objects provide a way to
2727
deploy custom labeling rules via the Kubernetes API.
2828
- [`local`](#local-feature-source) feature source of nfd-worker creates
29-
labels by reading text files and executing hooks.
29+
labels by reading text files.
3030
- [`custom`](#custom-feature-source) feature source of nfd-worker creates
3131
labels based on user-specified rules.
3232

@@ -232,13 +232,12 @@ point for external feature detectors. It provides a mechanism for pluggable
232232
extensions, allowing the creation of new user-specific features and even
233233
overriding built-in labels.
234234

235-
The `local` feature source has two methods for detecting features, feature
236-
files and hooks (hooks are deprecated and slated for removal in NFD v0.17). The
237-
features discovered by the `local` source can further be used in label rules
238-
specified in [`NodeFeatureRule`](#nodefeaturerule-custom-resource) objects and
235+
The `local` feature source uses feature files. The features discovered by the
236+
`local` source can further be used in label rules specified in
237+
[`NodeFeatureRule`](#nodefeaturerule-custom-resource) objects and
239238
the [`custom`](#custom-feature-source) feature source.
240239

241-
> **NOTE:** Be careful when creating and/or updating hook or feature files
240+
> **NOTE:** Be careful when creating and/or updating feature files
242241
> while NFD is running. To avoid race conditions you should write
243242
> into a temporary file, and atomically create/update the original file by
244243
> doing a file rename operation. NFD ignores dot files,
@@ -250,9 +249,7 @@ the [`custom`](#custom-feature-source) feature source.
250249

251250
Consider a plaintext file
252251
`/etc/kubernetes/node-feature-discovery/features.d/my-features`
253-
having the following contents (or alternatively a shell script
254-
`/etc/kubernetes/node-feature-discovery/source.d/my-hook.sh` having the
255-
following stdout output):
252+
having the following contents:
256253

257254
```plaintext
258255
feature.node.kubernetes.io/my-feature.1
@@ -274,47 +271,9 @@ The `local` source reads files found in
274271
`/etc/kubernetes/node-feature-discovery/features.d/`. File content is parsed
275272
and translated into node labels, see the [input format below](#input-format).
276273

277-
### Hooks
278-
279-
**DEPRECATED** Hooks are deprecated and will be completely removed in NFD
280-
v0.17.
281-
282-
The `local` source executes hooks found in
283-
`/etc/kubernetes/node-feature-discovery/source.d/`. The hook files must be
284-
executable and they are supposed to print all discovered features in `stdout`.
285-
Since NFD v0.13 the default container image only supports statically linked ELF
286-
binaries.
287-
288-
`stderr` output of hooks is propagated to NFD log so it can be used for
289-
debugging and logging.
290-
291-
NFD tries to execute any regular files found from the hooks directory.
292-
Any additional data files the hook might need (e.g. a configuration file)
293-
should be placed in a separate directory to avoid NFD unnecessarily
294-
trying to execute them. A subdirectory under the hooks directory can be used,
295-
for example `/etc/kubernetes/node-feature-discovery/source.d/conf/`.
296-
297-
> **NOTE:** Starting from release v0.14 hooks are disabled by default and can
298-
> be enabled via `sources.local.hooksEnabled` field in the worker
299-
> configuration.
300-
301-
```yaml
302-
sources:
303-
local:
304-
hooksEnabled: true # true by default at this point
305-
```
306-
307-
> **NOTE:** NFD will blindly run any executables placed/mounted in the hooks
308-
> directory. It is the user's responsibility to review the hooks for e.g.
309-
> possible security implications.
310-
>
311-
> **NOTE:** The [full](../deployment/image-variants.md#full) image variant
312-
> provides backwards-compatibility with older NFD versions by including a more
313-
> expanded environment, supporting bash and perl runtimes.
314-
315274
### Input format
316275

317-
The hook stdout and feature files are expected to contain features in simple
276+
The feature files are expected to contain features in simple
318277
key-value pairs, separated by newlines:
319278

320279
```plaintext
@@ -410,19 +369,16 @@ vendor.io/my-feature=value
410369
### Mounts
411370

412371
The standard NFD deployments contain `hostPath` mounts for
413-
`/etc/kubernetes/node-feature-discovery/source.d/` and
414372
`/etc/kubernetes/node-feature-discovery/features.d/`, making these directories
415373
from the host available inside the nfd-worker container.
416374

417375
#### Injecting labels from other pods
418376

419-
One use case for the feature files and hooks is detecting features in other
377+
One use case for the feature files is detecting features in other
420378
Pods outside NFD, e.g. in Kubernetes device plugins. By using the same
421-
`hostPath` mounts for `/etc/kubernetes/node-feature-discovery/source.d/` and
422-
`/etc/kubernetes/node-feature-discovery/features.d/` in the side-car (e.g.
423-
device plugin) creates a shared area for deploying feature files and hooks to
424-
NFD. NFD periodically scans the directories and reads any feature files and
425-
runs any hooks it finds.
379+
`hostPath` mounts `/etc/kubernetes/node-feature-discovery/features.d/`
380+
in the side-car (e.g. device plugin) creates a shared area for
381+
deploying feature files to NFD.
426382

427383
## Custom feature source
428384

@@ -1000,8 +956,8 @@ The following features are available for matching:
1000956
| | | **`major`** | int | First component of the kernel version (e.g. ‘4') |
1001957
| | | **`minor`** | int | Second component of the kernel version (e.g. ‘5') |
1002958
| | | **`revision`** | int | Third component of the kernel version (e.g. ‘6') |
1003-
| **`local.label`** | attribute | | | Labels from feature files and hooks, i.e. labels from the [*local* feature source](#local-feature-source) |
1004-
| **`local.feature`** | attribute | | | Features from feature files and hooks, i.e. features from the [*local* feature source](#local-feature-source) |
959+
| **`local.label`** | attribute | | | Labels from feature files, i.e. labels from the [*local* feature source](#local-feature-source) |
960+
| **`local.feature`** | attribute | | | Features from feature files, i.e. features from the [*local* feature source](#local-feature-source) |
1005961
| | | **`<label-name>`** | string | Label `<label-name>` created by the local feature source, value equals the value of the label |
1006962
| **`memory.nv`** | instance | | | NVDIMM devices present in the system |
1007963
| | | **`<sysfs-attribute>`** | string | Value of the sysfs device attribute, available attributes: `devtype`, `mode` |

pkg/nfd-worker/nfd-worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ func getFeatureLabels(source source.LabelSource, labelWhiteList regexp.Regexp) (
572572
name := k
573573
switch sourceName := source.Name(); sourceName {
574574
case "local", "custom":
575-
// No mangling of labels from the custom rules, hooks or feature files
575+
// No mangling of labels from the custom rules or feature files
576576
default:
577577
// Prefix for labels from other sources
578578
if !strings.Contains(name, "/") {

0 commit comments

Comments
 (0)