Skip to content

Commit 02dd550

Browse files
authored
Merge pull request #1378 from marquiz/devel/fix-er-filtering
nfd-master: fix filtering of extended resources
2 parents 902f76b + b09ce75 commit 02dd550

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

pkg/nfd-master/nfd-master.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ func filterExtendedResources(features *nfdv1alpha1.Features, extendedResources E
806806
func filterExtendedResource(name, value string, features *nfdv1alpha1.Features) (string, error) {
807807
// Check if given NS is allowed
808808
ns, _ := splitNs(name)
809-
if ns != nfdv1alpha1.ExtendedResourceNs && !strings.HasPrefix(ns, nfdv1alpha1.ExtendedResourceSubNsSuffix) {
809+
if ns != nfdv1alpha1.ExtendedResourceNs && !strings.HasSuffix(ns, nfdv1alpha1.ExtendedResourceSubNsSuffix) {
810810
if ns == "kubernetes.io" || strings.HasSuffix(ns, ".kubernetes.io") {
811811
return "", fmt.Errorf("namespace %q is not allowed", ns)
812812
}

test/e2e/data/nodefeaturerule-4.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323

2424
- name: "e2e static rule"
2525
extendedResources:
26-
vendor.io/static: "123"
26+
vendor.feature.node.kubernetes.io/static: "123"
2727
matchFeatures:
2828

2929
- name: "e2e not allowed rule"

test/e2e/node_feature_discovery_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,13 +771,13 @@ core:
771771
expectedTaints["*"] = []corev1.Taint{}
772772
eventuallyNonControlPlaneNodes(ctx, f.ClientSet).Should(MatchTaints(expectedTaints, nodes, false))
773773

774-
expectedAnnotations["*"] = k8sAnnotations{"nfd.node.kubernetes.io/extended-resources": "nons,vendor.io/dynamic,vendor.io/static"}
774+
expectedAnnotations["*"] = k8sAnnotations{"nfd.node.kubernetes.io/extended-resources": "nons,vendor.feature.node.kubernetes.io/static,vendor.io/dynamic"}
775775

776776
expectedCapacity := map[string]corev1.ResourceList{
777777
"*": {
778-
"feature.node.kubernetes.io/nons": resourcev1.MustParse("123"),
779-
"vendor.io/dynamic": resourcev1.MustParse("10"),
780-
"vendor.io/static": resourcev1.MustParse("123"),
778+
"feature.node.kubernetes.io/nons": resourcev1.MustParse("123"),
779+
"vendor.io/dynamic": resourcev1.MustParse("10"),
780+
"vendor.feature.node.kubernetes.io/static": resourcev1.MustParse("123"),
781781
},
782782
}
783783

0 commit comments

Comments
 (0)