1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-30 19:54:46 +00:00
node-feature-discovery/source/custom/static_features.go
Markus Lehtonen 0bc1b6c28f apis/nfd: drop creation helper functions
Drop the creation helper functions as one step in an effort to tidy up
the api package. These functions were not much used outside unit tests
anyway, the static rules of the nfd-worker custom feature source being
the only exception (and if those happened to be invalid we'd catch that
e.g. in the e2e-tests).
2023-12-14 15:54:51 +02:00

64 lines
1.9 KiB
Go

/*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package custom
import (
nfdv1alpha1 "sigs.k8s.io/node-feature-discovery/pkg/apis/nfd/v1alpha1"
)
// getStaticFeatures returns statically configured custom features to discover
// e.g RMDA related features. NFD configuration file may extend these custom features by adding rules.
func getStaticFeatureConfig() []CustomRule {
return []CustomRule{
{
nfdv1alpha1.Rule{
Name: "RDMA capable static rule",
Labels: map[string]string{"rdma.capable": "true"},
MatchFeatures: nfdv1alpha1.FeatureMatcher{
nfdv1alpha1.FeatureMatcherTerm{
Feature: "pci.device",
MatchExpressions: nfdv1alpha1.MatchExpressionSet{
"vendor": &nfdv1alpha1.MatchExpression{
Op: nfdv1alpha1.MatchIn,
Value: nfdv1alpha1.MatchValue{"15b3"}},
},
},
},
},
},
{
nfdv1alpha1.Rule{
Name: "RDMA available static rule",
Labels: map[string]string{"rdma.available": "true"},
MatchFeatures: nfdv1alpha1.FeatureMatcher{
nfdv1alpha1.FeatureMatcherTerm{
Feature: "kernel.loadedmodule",
MatchExpressions: nfdv1alpha1.MatchExpressionSet{
"ib_uverbs": &nfdv1alpha1.MatchExpression{
Op: nfdv1alpha1.MatchExists,
},
"rdma_ucm": &nfdv1alpha1.MatchExpression{
Op: nfdv1alpha1.MatchExists,
},
},
},
},
},
},
}
}