mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Merge pull request #538 from ArangoGutierrez/devel/go_report
make go report happy
This commit is contained in:
commit
6e039818eb
13 changed files with 30 additions and 25 deletions
|
@ -365,7 +365,7 @@ func TestSetLabels(t *testing.T) {
|
|||
apihelper.NewJsonPatch("add", "/metadata/labels", "valid.ns/feature-2", mockLabels["valid.ns/feature-2"]),
|
||||
}
|
||||
|
||||
mockMaster.args.ExtraLabelNs = map[string]struct{}{"valid.ns": struct{}{}}
|
||||
mockMaster.args.ExtraLabelNs = map[string]struct{}{"valid.ns": {}}
|
||||
mockMaster.annotationNs = instance + "." + AnnotationNsBase
|
||||
mockHelper.On("GetClient").Return(mockClient, nil)
|
||||
mockHelper.On("GetNode", mockClient, workerName).Return(mockNode, nil)
|
||||
|
@ -391,7 +391,7 @@ func TestSetLabels(t *testing.T) {
|
|||
apihelper.NewJsonPatch("add", "/status/capacity", LabelNs+"/feature-3", mockLabels["feature-3"]),
|
||||
}
|
||||
|
||||
mockMaster.args.ResourceLabels = map[string]struct{}{"feature-3": struct{}{}, "feature-1": struct{}{}}
|
||||
mockMaster.args.ResourceLabels = map[string]struct{}{"feature-3": {}, "feature-1": {}}
|
||||
mockHelper.On("GetClient").Return(mockClient, nil)
|
||||
mockHelper.On("GetNode", mockClient, workerName).Return(mockNode, nil)
|
||||
mockHelper.On("PatchNode", mockClient, mockNodeName, mock.MatchedBy(jsonPatchMatcher(expectedPatches))).Return(nil)
|
||||
|
|
|
@ -43,10 +43,10 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// Namespace for feature labels
|
||||
// LabelNs defines the Namespace for feature labels
|
||||
LabelNs = "feature.node.kubernetes.io"
|
||||
|
||||
// Base namespace for all NFD-related annotations
|
||||
// AnnotationNsBase namespace for all NFD-related annotations
|
||||
AnnotationNsBase = "nfd.node.kubernetes.io"
|
||||
|
||||
// NFD Annotations
|
||||
|
@ -65,7 +65,7 @@ type ExtendedResources map[string]string
|
|||
// Annotations are used for NFD-related node metadata
|
||||
type Annotations map[string]string
|
||||
|
||||
// Command line arguments
|
||||
// Args holds command line arguments
|
||||
type Args struct {
|
||||
CaFile string
|
||||
CertFile string
|
||||
|
|
|
@ -51,13 +51,13 @@ func newDefaultConfig() *config {
|
|||
return &config{}
|
||||
}
|
||||
|
||||
// Implements FeatureSource Interface
|
||||
// Source implements FeatureSource Interface
|
||||
type Source struct {
|
||||
config *config
|
||||
}
|
||||
|
||||
// Return name of the feature source
|
||||
func (s Source) Name() string { return Name }
|
||||
// Name returns the name of the feature source
|
||||
func (s Source) Name() string { return "custom" }
|
||||
|
||||
// NewConfig method of the FeatureSource interface
|
||||
func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
// Directory stores the full path for the custom sources folder
|
||||
const Directory = "/etc/kubernetes/node-feature-discovery/custom.d"
|
||||
|
||||
// getDirectoryFeatureConfig returns features configured in the "/etc/kubernetes/node-feature-discovery/custom.d"
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// Rule that matches on loaded kernel modules in the system
|
||||
// LoadedKModRule matches loaded kernel modules in the system
|
||||
type LoadedKModRule []string
|
||||
|
||||
const kmodProcfsPath = "/proc/modules"
|
||||
|
|
|
@ -13,6 +13,7 @@ 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 rules
|
||||
|
||||
import (
|
||||
|
@ -26,7 +27,7 @@ var (
|
|||
nodeName = os.Getenv("NODE_NAME")
|
||||
)
|
||||
|
||||
// Rule that matches on nodenames configured in a ConfigMap
|
||||
// NodenameRule matches on nodenames configured in a ConfigMap
|
||||
type NodenameRule []string
|
||||
|
||||
// Force implementation of Rule
|
||||
|
|
|
@ -24,20 +24,20 @@ import (
|
|||
// e.g RMDA related features. NFD configuration file may extend these custom features by adding rules.
|
||||
func getStaticFeatureConfig() []FeatureSpec {
|
||||
return []FeatureSpec{
|
||||
FeatureSpec{
|
||||
{
|
||||
Name: "rdma.capable",
|
||||
MatchOn: []MatchRule{
|
||||
MatchRule{
|
||||
{
|
||||
PciID: &rules.PciIDRule{
|
||||
PciIDRuleInput: rules.PciIDRuleInput{Vendor: []string{"15b3"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
FeatureSpec{
|
||||
{
|
||||
Name: "rdma.available",
|
||||
MatchOn: []MatchRule{
|
||||
MatchRule{
|
||||
{
|
||||
LoadedKMod: &rules.LoadedKModRule{"ib_uverbs", "rdma_ucm"},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"github.com/klauspost/cpuid/v2"
|
||||
)
|
||||
|
||||
// Discover returns feature names for all the supported CPU features.
|
||||
// GetCpuidFlags returns feature names for all the supported CPU features.
|
||||
func GetCpuidFlags() []string {
|
||||
return cpuid.CPU.FeatureSet()
|
||||
}
|
||||
|
|
|
@ -68,12 +68,12 @@ func readPciDevInfo(devPath string, deviceAttrSpec map[string]bool) (PciDeviceIn
|
|||
return info, nil
|
||||
}
|
||||
|
||||
// List available PCI devices and retrieve device attributes.
|
||||
// DetectPci lists available PCI devices and retrieve device attributes.
|
||||
// deviceAttrSpec is a map which specifies which attributes to retrieve.
|
||||
// a false value for a specific attribute marks the attribute as optional.
|
||||
// a true value for a specific attribute marks the attribute as mandatory.
|
||||
// "class" attribute is considered mandatory.
|
||||
// DetectPci() will fail if the retrieval of a mandatory attribute fails.
|
||||
// will fail if the retrieval of a mandatory attribute fails.
|
||||
func DetectPci(deviceAttrSpec map[string]bool) (map[string][]PciDeviceInfo, error) {
|
||||
sysfsBasePath := source.SysfsDir.Path("bus/pci/devices")
|
||||
devInfo := make(map[string][]PciDeviceInfo)
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
const Name = "iommu"
|
||||
|
||||
// Implement FeatureSource interface
|
||||
// Source implements FeatureSource interface
|
||||
type Source struct{}
|
||||
|
||||
func (s Source) Name() string { return Name }
|
||||
|
|
|
@ -38,10 +38,11 @@ var (
|
|||
hookDir = "/etc/kubernetes/node-feature-discovery/source.d/"
|
||||
)
|
||||
|
||||
// Implement FeatureSource interface
|
||||
// Source implements FeatureSource interface
|
||||
type Source struct{}
|
||||
|
||||
func (s Source) Name() string { return Name }
|
||||
// Name returns the name of the feature source
|
||||
func (s Source) Name() string { return "local" }
|
||||
|
||||
// NewConfig method of the FeatureSource interface
|
||||
func (s *Source) NewConfig() source.Config { return nil }
|
||||
|
@ -52,6 +53,7 @@ func (s *Source) GetConfig() source.Config { return nil }
|
|||
// SetConfig method of the FeatureSource interface
|
||||
func (s *Source) SetConfig(source.Config) {}
|
||||
|
||||
// Discover returns features from hooks and files
|
||||
func (s Source) Discover() (source.Features, error) {
|
||||
featuresFromHooks, err := getFeaturesFromHooks()
|
||||
if err != nil {
|
||||
|
|
|
@ -41,13 +41,13 @@ func newDefaultConfig() *Config {
|
|||
}
|
||||
}
|
||||
|
||||
// Implement FeatureSource interface
|
||||
// Source implements FeatureSource interface
|
||||
type Source struct {
|
||||
config *Config
|
||||
}
|
||||
|
||||
// Return name of the feature source
|
||||
func (s Source) Name() string { return Name }
|
||||
// Name returns the name of the feature source
|
||||
func (s Source) Name() string { return "pci" }
|
||||
|
||||
// NewConfig method of the FeatureSource interface
|
||||
func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
|
||||
|
|
|
@ -44,13 +44,13 @@ func newDefaultConfig() *Config {
|
|||
}
|
||||
}
|
||||
|
||||
// Implement FeatureSource interface
|
||||
// Source implements FeatureSource interface
|
||||
type Source struct {
|
||||
config *Config
|
||||
}
|
||||
|
||||
// Return name of the feature source
|
||||
func (s Source) Name() string { return Name }
|
||||
// Name returns the name of the feature source
|
||||
func (s Source) Name() string { return "usb" }
|
||||
|
||||
// NewConfig method of the FeatureSource interface
|
||||
func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
|
||||
|
|
Loading…
Reference in a new issue