Skip to content

Commit 10fad3b

Browse files
committed
Enable unprefixed label setting via feature gate
Currently, unprefixed labels are not allowed, despite the existence of the DisableAutoPrefix feature gate, which is intended for this purpose. This change ensures that when DisableAutoPrefix is set to True, the namespace addition is skipped, allowing unprefixed labels. Signed-off-by: Feruzjon Muyassarov <[email protected]>
1 parent c1c0b81 commit 10fad3b

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

docs/reference/feature-gates.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ to `false`, a NodeFeatureRule with
5454
labels:
5555
foo: bar
5656
```
57-
58-
will turn into `feature.node.kubernetes.io/foo=bar` node label. With
59-
`DisableAutoPrefix` set to `true`, no prefix is added and the label will be
60-
filtered out.
61-
62-
Note that taint keys are not affected by this feature gate.
57+
will be automatically prefixed, resulting in the node label `feature.node.kubernetes.io/foo=bar`.
58+
However, when `DisableAutoPrefix` is set to `true`, no prefix is added, and the label remains as
59+
`foo=bar`. Note that taint keys are not affected by this feature gate.

pkg/nfd-master/nfd-master.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ func (m *nfdMaster) filterFeatureLabels(labels Labels, features *nfdv1alpha1.Fea
482482

483483
return outLabels
484484
}
485-
486485
func (m *nfdMaster) filterFeatureLabel(name, value string, features *nfdv1alpha1.Features) (string, error) {
487486
// Check if Value is dynamic
488487
var filteredValue string
@@ -504,7 +503,9 @@ func (m *nfdMaster) filterFeatureLabel(name, value string, features *nfdv1alpha1
504503
return "", fmt.Errorf("namespace %q is not allowed", ns)
505504
}
506505
} else if err != nil {
507-
return "", err
506+
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.DisableAutoPrefix) || err != validate.ErrUnprefixedKeysNotAllowed {
507+
return "", err
508+
}
508509
}
509510

510511
// Skip if label doesn't match labelWhiteList

0 commit comments

Comments
 (0)