1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00
node-feature-discovery/source/custom/static_features.go
Markus Lehtonen b5b701fbbf Simplify code
Drop unnecessry typedefs.
2024-07-09 09:05:33 +03:00

60 lines
1.8 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/api/nfd/v1alpha1"
)
// getStaticRules returns statically configured custom features to discover
// e.g RMDA related features. NFD configuration file may extend these custom features by adding rules.
func getStaticRules() []nfdv1alpha1.Rule {
return []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"}},
},
},
},
},
{
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,
},
},
},
},
},
}
}