1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-15 04:57:56 +00:00

apis/nfd: fix templates with MatchAny only

Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
This commit is contained in:
Viktor Oreshkin 2022-08-22 02:29:50 +03:00 committed by k8s-infra-cherrypick-robot
parent 18c314df68
commit 88199edea8

View file

@ -50,11 +50,13 @@ func (r *Rule) Execute(features feature.Features) (RuleOutput, error) {
matched = true
utils.KlogDump(4, "matches for matchAny "+r.Name, " ", matches)
if r.labelsTemplate == nil {
// No templating so we stop here (further matches would just
// produce the same labels)
if r.LabelsTemplate == "" && r.VarsTemplate == "" {
// there's no need to evaluate other matchers in MatchAny
// if there are no templates to be executed on them - so
// short-circuit and stop on first match here
break
}
if err := r.executeLabelsTemplate(matches, labels); err != nil {
return RuleOutput{}, err
}