Skip to content

Commit dabd766

Browse files
authored
Merge pull request #1436 from marquiz/devel/docs-customization-guide
docs: edits to customization guide
2 parents e2c7c8f + 0a30cf9 commit dabd766

File tree

1 file changed

+60
-51
lines changed

1 file changed

+60
-51
lines changed

docs/usage/customization-guide.md

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ Now, on X86 platforms the feature label appears after doing `modprobe dummy` on
158158
a system and correspondingly the label is removed after `rmmod dummy`. Note a
159159
re-labeling delay up to the sleep-interval of nfd-worker (1 minute by default).
160160

161-
See [Label rule format](#label-rule-format) for detailed description of
161+
See [Feature rule format](#feature-rule-format) for detailed description of
162162
available fields and how to write labeling rules.
163163

164-
### NodeFeatureRule tainting feature
164+
### Node tainting
165165

166166
This feature is experimental.
167167

@@ -178,48 +178,14 @@ To enable the tainting feature, `--enable-taints` flag needs to be set to `true`
178178
If the flag `--enable-taints` is set to `false` (i.e. disabled), taints defined in
179179
the NodeFeatureRule CR have no effect and will be ignored by the NFD master.
180180

181+
See documentation of the [taints field](#taints) for detailed description how
182+
to specify taints in the NodeFeatureRule object.
183+
181184
> **NOTE:** Before enabling any taints, make sure to edit nfd-worker daemonset
182185
> to tolerate the taints to be created. Otherwise, already running pods that do
183186
> not tolerate the taint are evicted immediately from the node including the
184187
> nfd-worker pod.
185188

186-
Example NodeFeatureRule with custom taints:
187-
188-
```yaml
189-
apiVersion: nfd.k8s-sigs.io/v1alpha1
190-
kind: NodeFeatureRule
191-
metadata:
192-
name: my-sample-rule-object
193-
spec:
194-
rules:
195-
- name: "my sample taint rule"
196-
taints:
197-
- effect: PreferNoSchedule
198-
key: "feature.node.kubernetes.io/special-node"
199-
value: "true"
200-
- effect: NoExecute
201-
key: "feature.node.kubernetes.io/dedicated-node"
202-
matchFeatures:
203-
- feature: kernel.loadedmodule
204-
matchExpressions:
205-
dummy: {op: Exists}
206-
- feature: kernel.config
207-
matchExpressions:
208-
X86: {op: In, value: ["y"]}
209-
```
210-
211-
In this example, if the `my sample taint rule` rule is matched, `feature.node.kubernetes.io/pci-0300_1d0f.present=true:NoExecute`
212-
and `feature.node.kubernetes.io/cpu-cpuid.ADX:NoExecute` taints are set on the node.
213-
214-
There are some limitations to the namespace part (i.e. prefix/) of the taint
215-
key:
216-
217-
- `kubernetes.io/` and its sub-namespaces (like `sub.ns.kubernetes.io/`) cannot
218-
generally be used
219-
- the only exception is `feature.node.kubernetes.io/` and its sub-namespaces
220-
(like `sub.ns.feature.node.kubernetes.io`)
221-
- unprefixed keys (like `foo`) keys are disallowed
222-
223189
## Local feature source
224190

225191
NFD-Worker has a special feature source named `local` which is an integration
@@ -503,7 +469,7 @@ The namespace part (i.e. prefix) of the labels is controlled by nfd:
503469
command line flag of nfd-master.
504470
e.g: `nfd-master -deny-label-ns="*" -extra-label-ns=example.com`
505471

506-
## Label rule format
472+
## Feature rule format
507473

508474
This section describes the rule format used in
509475
[`NodeFeatureRule`](#nodefeaturerule-custom-resource) objects and in the
@@ -544,11 +510,11 @@ the matchers):
544510

545511
### Fields
546512

547-
#### Name
513+
#### name
548514

549515
The `.name` field is required and used as an identifier of the rule.
550516

551-
#### Labels
517+
#### labels
552518

553519
The `.labels` is a map of the node labels to create if the rule matches.
554520

@@ -584,7 +550,7 @@ This will yield into the following node label:
584550
feature.node.kubernetes.io/custom-label: "customlabel"
585551
```
586552

587-
#### Labels template
553+
#### labelsTemplate
588554

589555
The `.labelsTemplate` field specifies a text template for dynamically creating
590556
labels based on the matched features. See [templating](#templating) for
@@ -594,9 +560,10 @@ details.
594560
> labels specified in the `labels` field will override anything
595561
> originating from `labelsTemplate`.
596562

597-
#### Node Annotations
563+
#### annotations
598564

599-
The `.annotations` field is a list of features to be advertised as annotations.
565+
The `.annotations` field is a list of features to be advertised as node
566+
annotations.
600567

601568
Take this rule as a referential example:
602569

@@ -642,23 +609,61 @@ NFD enforces some limitations to the namespace (or prefix)/ of the annotations:
642609
> annotations the features won't be advertised as node labels unless they are
643610
> specified in the `labels` field.
644611

645-
#### Taints
612+
#### taints
646613

647614
*taints* is a list of taint entries and each entry can have `key`, `value` and `effect`,
648615
where the `value` is optional. Effect could be `NoSchedule`, `PreferNoSchedule`
649616
or `NoExecute`. To learn more about the meaning of these effects, check out k8s [documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/).
650617

618+
Example NodeFeatureRule with taints:
619+
620+
```yaml
621+
apiVersion: nfd.k8s-sigs.io/v1alpha1
622+
kind: NodeFeatureRule
623+
metadata:
624+
name: my-sample-rule-object
625+
spec:
626+
rules:
627+
- name: "my sample taint rule"
628+
taints:
629+
- effect: PreferNoSchedule
630+
key: "feature.node.kubernetes.io/special-node"
631+
value: "true"
632+
- effect: NoExecute
633+
key: "feature.node.kubernetes.io/dedicated-node"
634+
matchFeatures:
635+
- feature: kernel.loadedmodule
636+
matchExpressions:
637+
dummy: {op: Exists}
638+
- feature: kernel.config
639+
matchExpressions:
640+
X86: {op: In, value: ["y"]}
641+
```
642+
643+
In this example, if the `my sample taint rule` rule is matched,
644+
`feature.node.kubernetes.io/pci-0300_1d0f.present=true:NoExecute`
645+
and `feature.node.kubernetes.io/cpu-cpuid.ADX:NoExecute` taints are set on the node.
646+
647+
There are some limitations to the namespace part (i.e. prefix/) of the taint
648+
key:
649+
650+
- `kubernetes.io/` and its sub-namespaces (like `sub.ns.kubernetes.io/`) cannot
651+
generally be used
652+
- the only exception is `feature.node.kubernetes.io/` and its sub-namespaces
653+
(like `sub.ns.feature.node.kubernetes.io`)
654+
- unprefixed keys (like `foo`) keys are disallowed
655+
651656
> **NOTE:** taints field is not available for the custom rules of nfd-worker
652657
> and only for NodeFeatureRule objects.
653658

654-
#### Vars
659+
#### vars
655660

656661
The `.vars` field is a map of values (key-value pairs) to store for subsequent
657662
rules to use. In other words, these are variables that are not advertised as
658663
node labels. See [backreferences](#backreferences) for more details on the
659664
usage of vars.
660665

661-
#### Extended resources
666+
#### extendedResources
662667

663668
The `.extendedResources` field is a list of extended resources to advertise.
664669
See [extended resources](#extended-resources) for more details.
@@ -717,7 +722,11 @@ Resources names:
717722
- unprefixed names will get prefixed with `feature.node.kubernetes.io/`
718723
automatically (e.g. `foo` becomes `feature.node.kubernetes.io/foo`)
719724

720-
#### Vars template
725+
> **NOTE:** `.extendedResources` is not supported by the
726+
> [custom feature source](#custom-feature-source) -- it can only be used in
727+
> NodeFeatureRule objects.
728+
729+
#### varsTemplate
721730

722731
The `.varsTemplate` field specifies a text template for dynamically creating
723732
vars based on the matched features. See [templating](#templating) for details
@@ -728,7 +737,7 @@ the usage of vars.
728737
> vars specified in the `vars` field will override anything originating from
729738
> `varsTemplate`.
730739

731-
#### MatchFeatures
740+
#### matchFeatures
732741

733742
The `.matchFeatures` field specifies a feature matcher, consisting of a list of
734743
feature matcher terms. It implements a logical AND over the terms i.e. all
@@ -776,7 +785,7 @@ element whose name matches the `<key>`. However, for *instance* features all
776785
MatchExpressions are evaluated against the attributes of each instance
777786
separately.
778787

779-
#### MatchAny
788+
#### matchAny
780789

781790
The `.matchAny` field is a list of of [`matchFeatures`](#matchfeatures)
782791
matchers. A logical OR is applied over the matchers, i.e. at least one of them

0 commit comments

Comments
 (0)