Skip to content

Commit 225070e

Browse files
committed
nfd-master: drop the deprecated autoDefaultNs config option
The autoDefaultNs was deprecated in NFD v0.16 and replaced by the DisableAutoPrefix feature gate.
1 parent 7fba8f5 commit 225070e

File tree

5 files changed

+11
-52
lines changed

5 files changed

+11
-52
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# noPublish: false
2-
# autoDefaultNs: true
32
# extraLabelNs: ["added.ns.io","added.kubernets.io"]
43
# denyLabelNs: ["denied.ns.io","denied.kubernetes.io"]
54
# enableTaints: false

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ master:
2323
dnsPolicy: ClusterFirstWithHostNet
2424
config: ### <NFD-MASTER-CONF-START-DO-NOT-REMOVE>
2525
# noPublish: false
26-
# autoDefaultNs: true
2726
# extraLabelNs: ["added.ns.io","added.kubernets.io"]
2827
# denyLabelNs: ["denied.ns.io","denied.kubernetes.io"]
2928
# enableTaints: false

docs/reference/master-configuration-reference.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -65,42 +65,6 @@ Example:
6565
denyLabelNs: ["denied.ns.io","denied.kubernetes.io"]
6666
```
6767

68-
## autoDefaultNs
69-
70-
**DEPRECATED**: Will be removed in NFD v0.17. Use the
71-
[DisableAutoPrefix](feature-gates.md#disableautoprefix) feature gate instead.
72-
73-
The `autoDefaultNs` option controls the automatic prefixing of names. When set
74-
to true (the default in NFD version {{ site.version }}) nfd-master
75-
automatically adds the default `feature.node.kubernetes.io/` prefix to
76-
unprefixed labels, annotations and extended resources - this is also the
77-
default behavior in NFD v0.15 and earlier. When the option is set to `false`,
78-
no prefix will be prepended to unprefixed names, effectively causing them to be
79-
filtered out (as NFD does not allow unprefixed names of labels, annotations or
80-
extended resources). The default will be changed to `false` in a future
81-
release.
82-
83-
For example, with the `autoDefaultNs` set to `true`, a NodeFeatureRule with
84-
85-
```yaml
86-
labels:
87-
foo: bar
88-
```
89-
90-
Will turn into `feature.node.kubernetes.io/foo=bar` node label. With
91-
`autoDefaultNs` set to `false`, no prefix is added and the label will be
92-
filtered out.
93-
94-
Note that taint keys are not affected by this option.
95-
96-
Default: `true`
97-
98-
Example:
99-
100-
```yaml
101-
autoDefaultNs: false
102-
```
103-
10468
## enableTaints
10569
`enableTaints` enables/disables node tainting feature of NFD.
10670

docs/usage/customization-guide.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,9 @@ vendor.io/my-feature=value
361361
> **NOTE:** use of unprefixed label names (like `foo=bar`) should not be used.
362362
> In NFD {{ site.version }} unprefixed names will be automatically prefixed
363363
> with `feature.node.kubernetes.io/` but this will change in a future version
364-
> (see
365-
> [autoDefaultNs config option](../reference/master-configuration-reference.md#autoDefaultNs).
366-
> Unprefixed names for plain Features (tagged with `# +no-label`) can be used
367-
> without restrictions, however.
364+
> (see the [DisableAutoPrefix](../reference/feature-gates.md#disableautoprefix)
365+
> feature gate). Unprefixed names for plain Features (tagged with `#+no-label`)
366+
> can be used without restrictions, however.
368367

369368
### Mounts
370369

@@ -608,8 +607,8 @@ NFD enforces some limitations to the namespace (or prefix)/ of the annotations:
608607
(like `sub.ns.feature.node.kubernetes.io`)
609608
- unprefixed names (like `my-annotation`) should not be used. In NFD {{
610609
site.version }} unprefixed names will be automatically prefixed with
611-
`feature.node.kubernetes.io/` but this will change in a future version (see
612-
[autoDefaultNs config option](../reference/master-configuration-reference.md#autoDefaultNs).
610+
`feature.node.kubernetes.io/` but this will change in a future version (see the
611+
[DisableAutoPrefix](../reference/feature-gates.md#disableautoprefix) feature gate).
613612

614613
> **NOTE:** The `annotations` field has will only advertise features via node
615614
> annotations the features won't be advertised as node labels unless they are
@@ -727,8 +726,8 @@ Resources names:
727726
(like `sub.ns.feature.node.kubernetes.io`)
728727
- unprefixed names (like `my-er`) site.version }} unprefixed names will be
729728
automatically prefixed with `feature.node.kubernetes.io/` but this will
730-
change in a future version (see
731-
[autoDefaultNs config option](../reference/master-configuration-reference.md#autoDefaultNs).
729+
change in a future version (see the
730+
[DisableAutoPrefix](../reference/feature-gates.md#disableautoprefix) feature gate).
732731

733732
> **NOTE:** `.extendedResources` is not supported by the
734733
> [custom feature source](#custom-feature-source) -- it can only be used in

pkg/nfd-master/nfd-master.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ type Restrictions struct {
8181

8282
// NFDConfig contains the configuration settings of NfdMaster.
8383
type NFDConfig struct {
84-
AutoDefaultNs bool
8584
DenyLabelNs utils.StringSetVal
8685
ExtraLabelNs utils.StringSetVal
8786
LabelWhiteList *regexp.Regexp
@@ -238,7 +237,6 @@ func newDefaultConfig() *NFDConfig {
238237
DenyLabelNs: utils.StringSetVal{},
239238
ExtraLabelNs: utils.StringSetVal{},
240239
NoPublish: false,
241-
AutoDefaultNs: true,
242240
NfdApiParallelism: 10,
243241
EnableTaints: false,
244242
ResyncPeriod: utils.DurationVal{Duration: time.Duration(1) * time.Hour},
@@ -634,7 +632,7 @@ func (m *nfdMaster) getAndMergeNodeFeatures(nodeName string) (*nfdv1alpha1.NodeF
634632
features.Labels = nil
635633
}
636634

637-
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) && m.config.AutoDefaultNs {
635+
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) {
638636
features.Labels = addNsToMapKeys(features.Labels, nfdv1alpha1.FeatureLabelNs)
639637
}
640638

@@ -645,7 +643,7 @@ func (m *nfdMaster) getAndMergeNodeFeatures(nodeName string) (*nfdv1alpha1.NodeF
645643
s.Labels = nil
646644
}
647645

648-
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) && m.config.AutoDefaultNs {
646+
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) {
649647
s.Labels = addNsToMapKeys(s.Labels, nfdv1alpha1.FeatureLabelNs)
650648
}
651649

@@ -815,7 +813,7 @@ func filterExtendedResource(name, value string, features *nfdv1alpha1.Features)
815813
}
816814

817815
func (m *nfdMaster) refreshNodeFeatures(cli k8sclient.Interface, node *corev1.Node, labels map[string]string, features *nfdv1alpha1.Features) error {
818-
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) && m.config.AutoDefaultNs {
816+
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) {
819817
labels = addNsToMapKeys(labels, nfdv1alpha1.FeatureLabelNs)
820818
} else if labels == nil {
821819
labels = make(map[string]string)
@@ -973,7 +971,7 @@ func (m *nfdMaster) processNodeFeatureRule(nodeName string, features *nfdv1alpha
973971
l := ruleOut.Labels
974972
e := ruleOut.ExtendedResources
975973
a := ruleOut.Annotations
976-
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) && m.config.AutoDefaultNs {
974+
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) {
977975
l = addNsToMapKeys(ruleOut.Labels, nfdv1alpha1.FeatureLabelNs)
978976
e = addNsToMapKeys(ruleOut.ExtendedResources, nfdv1alpha1.ExtendedResourceNs)
979977
a = addNsToMapKeys(ruleOut.Annotations, nfdv1alpha1.FeatureAnnotationNs)

0 commit comments

Comments
 (0)