diff --git a/pkg/apis/nfd/nodefeaturerule/rule.go b/pkg/apis/nfd/nodefeaturerule/rule.go index 5f1cacf5f2..f243e67e77 100644 --- a/pkg/apis/nfd/nodefeaturerule/rule.go +++ b/pkg/apis/nfd/nodefeaturerule/rule.go @@ -268,7 +268,8 @@ func evaluateFeatureMatcher(m *nfdv1alpha1.FeatureMatcher, features *nfdv1alpha1 fA, okA := features.Attributes[featureName] fI, okI := features.Instances[featureName] if !okF && !okA && !okI { - return false, nil, fmt.Errorf("feature %q not available", featureName) + klog.V(2).InfoS("feature not available", "featureName", featureName) + return false, nil, nil } if term.MatchExpressions != nil { diff --git a/pkg/apis/nfd/nodefeaturerule/rule_test.go b/pkg/apis/nfd/nodefeaturerule/rule_test.go index 86b5efd19f..45e178cbdd 100644 --- a/pkg/apis/nfd/nodefeaturerule/rule_test.go +++ b/pkg/apis/nfd/nodefeaturerule/rule_test.go @@ -53,8 +53,10 @@ func TestRule(t *testing.T) { assert.Nilf(t, err, "unexpected error: %v", err) assert.Equal(t, r1.Labels, m.Labels, "empty matcher should have matched empty features") - _, err = Execute(r2, f, true) - assert.Error(t, err, "matching against a missing feature should have returned an error") + m, err = Execute(r2, f, true) + assert.NoError(t, err, "matching against a missing feature should not have returned an error") + assert.Empty(t, m.Labels) + assert.Empty(t, m.Vars) // Test properly initialized empty features f = nfdv1alpha1.NewFeatures() @@ -64,8 +66,10 @@ func TestRule(t *testing.T) { assert.Equal(t, r1.Labels, m.Labels, "empty matcher should have matched empty features") assert.Empty(t, r1.Vars, "vars should be empty") - _, err = Execute(r2, f, true) - assert.Error(t, err, "matching against a missing feature type should have returned an error") + m, err = Execute(r2, f, true) + assert.NoError(t, err, "matching against a missing feature should not have returned an error") + assert.Empty(t, m.Labels) + assert.Empty(t, m.Vars) // Test empty feature sets f.Flags["domain-1.kf-1"] = nfdv1alpha1.NewFlagFeatures()