Repository: kubernetes-sigs/node-feature-discovery
Pull request #596 (2021-09-15 12:41:09)

source: rename FeatureSource to LabelSource
Prepare for separating feature detection from label creation.

First piece of #464. 


Patch:
diff --git a/Makefile b/Makefile
index fec4da33f..b50d97b97 100644
--- a/Makefile
+++ b/Makefile
@@ -99,7 +99,7 @@ templates:
 	@rm nfd-worker.conf.tmp
 
 mock:
-	mockery --name=FeatureSource --dir=source --inpkg --note="Re-generate by running 'make mock'"
+	mockery --name=LabelSource --dir=source --inpkg --note="Re-generate by running 'make mock'"
 	mockery --name=APIHelpers --dir=pkg/apihelper --inpkg --note="Re-generate by running 'make mock'"
 	mockery --name=LabelerClient --dir=pkg/labeler --inpkg --note="Re-generate by running 'make mock'"
 
diff --git a/pkg/nfd-client/worker/nfd-worker.go b/pkg/nfd-client/worker/nfd-worker.go
index a1888f4f2..d34467c70 100644
--- a/pkg/nfd-client/worker/nfd-worker.go
+++ b/pkg/nfd-client/worker/nfd-worker.go
@@ -99,10 +99,10 @@ type nfdWorker struct {
 	client         pb.LabelerClient
 	configFilePath string
 	config         *NFDConfig
-	realSources    []source.FeatureSource
+	realSources    []source.LabelSource
 	stop           chan struct{} // channel for signaling stop
-	testSources    []source.FeatureSource
-	enabledSources []source.FeatureSource
+	testSources    []source.LabelSource
+	enabledSources []source.LabelSource
 }
 
 type duration struct {
@@ -121,7 +121,7 @@ func NewNfdWorker(args *Args) (nfdclient.NfdClient, error) {
 
 		args:   *args,
 		config: &NFDConfig{},
-		realSources: []source.FeatureSource{
+		realSources: []source.LabelSource{
 			&cpu.Source{},
 			&iommu.Source{},
 			&kernel.Source{},
@@ -136,7 +136,7 @@ func NewNfdWorker(args *Args) (nfdclient.NfdClient, error) {
 			// labels from other sources
 			&local.Source{},
 		},
-		testSources: []source.FeatureSource{
+		testSources: []source.LabelSource{
 			&fake.Source{},
 		},
 		stop: make(chan struct{}, 1),
@@ -311,7 +311,7 @@ func (w *nfdWorker) configureCore(c coreConfig) error {
 		sourceList[strings.TrimSpace(s)] = struct{}{}
 	}
 
-	w.enabledSources = []source.FeatureSource{}
+	w.enabledSources = []source.LabelSource{}
 	for _, s := range w.realSources {
 		if _, enabled := sourceList[s.Name()]; all || enabled {
 			w.enabledSources = append(w.enabledSources, s)
@@ -400,7 +400,7 @@ func (w *nfdWorker) configure(filepath string, overrides string) error {
 
 // createFeatureLabels returns the set of feature labels from the enabled
 // sources and the whitelist argument.
-func createFeatureLabels(sources []source.FeatureSource, labelWhiteList regexp.Regexp) (labels Labels) {
+func createFeatureLabels(sources []source.LabelSource, labelWhiteList regexp.Regexp) (labels Labels) {
 	labels = Labels{}
 
 	// Do feature discovery from all configured sources.
@@ -423,7 +423,7 @@ func createFeatureLabels(sources []source.FeatureSource, labelWhiteList regexp.R
 
 // getFeatureLabels returns node labels for features discovered by the
 // supplied source.
-func getFeatureLabels(source source.FeatureSource, labelWhiteList regexp.Regexp) (labels Labels, err error) {
+func getFeatureLabels(source source.LabelSource, labelWhiteList regexp.Regexp) (labels Labels, err error) {
 	labels = Labels{}
 	features, err := source.Discover()
 	if err != nil {
diff --git a/source/cpu/cpu.go b/source/cpu/cpu.go
index 6bc5878bb..1563b9235 100644
--- a/source/cpu/cpu.go
+++ b/source/cpu/cpu.go
@@ -78,7 +78,7 @@ type keyFilter struct {
 	whitelist bool
 }
 
-// Implement FeatureSource interface
+// Source implements LabelSource.
 type Source struct {
 	config      *Config
 	cpuidFilter *keyFilter
@@ -86,13 +86,13 @@ type Source struct {
 
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return s.config }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(conf source.Config) {
 	switch v := conf.(type) {
 	case *Config:
@@ -103,8 +103,8 @@ func (s *Source) SetConfig(conf source.Config) {
 	}
 }
 
-func (s *Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s *Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	// Check if hyper-threading seems to be enabled
 	found, err := haveThreadSiblings()
diff --git a/source/custom/custom.go b/source/custom/custom.go
index 6783b4b41..b1bca0d94 100644
--- a/source/custom/custom.go
+++ b/source/custom/custom.go
@@ -51,7 +51,7 @@ func newDefaultConfig() *config {
 	return &config{}
 }
 
-// Source implements FeatureSource Interface
+// Source implements LabelSource.
 type Source struct {
 	config *config
 }
@@ -59,13 +59,13 @@ type Source struct {
 // Name returns the name of the feature source
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return s.config }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(conf source.Config) {
 	switch v := conf.(type) {
 	case *config:
@@ -76,8 +76,8 @@ func (s *Source) SetConfig(conf source.Config) {
 }
 
 // Discover features
-func (s Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 	allFeatureConfig := append(getStaticFeatureConfig(), *s.config...)
 	allFeatureConfig = append(allFeatureConfig, getDirectoryFeatureConfig()...)
 	utils.KlogDump(2, "custom features configuration:", "  ", allFeatureConfig)
diff --git a/source/fake/fake.go b/source/fake/fake.go
index 0a90277db..43e676b02 100644
--- a/source/fake/fake.go
+++ b/source/fake/fake.go
@@ -40,7 +40,7 @@ func newDefaultConfig() *Config {
 	}
 }
 
-// Source implements FeatureSource.
+// Source implements LabelSource.
 type Source struct {
 	config *Config
 }
@@ -48,13 +48,13 @@ type Source struct {
 // Name returns an identifier string for this feature source.
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return s.config }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(conf source.Config) {
 	switch v := conf.(type) {
 	case *Config:
@@ -64,13 +64,13 @@ func (s *Source) SetConfig(conf source.Config) {
 	}
 }
 
-// Configure method of the FeatureSource interface
+// Configure method of the LabelSource interface
 func (s Source) Configure([]byte) error { return nil }
 
 // Discover returns feature names for some fake features.
-func (s Source) Discover() (source.Features, error) {
+func (s Source) Discover() (source.FeatureLabels, error) {
 	// Adding three fake features.
-	features := make(source.Features, len(s.config.Labels))
+	features := make(source.FeatureLabels, len(s.config.Labels))
 	for k, v := range s.config.Labels {
 		features[k] = v
 	}
diff --git a/source/iommu/iommu.go b/source/iommu/iommu.go
index 89da1684e..36849a847 100644
--- a/source/iommu/iommu.go
+++ b/source/iommu/iommu.go
@@ -25,23 +25,22 @@ import (
 
 const Name = "iommu"
 
-// Implement FeatureSource interface
-// Source implements FeatureSource interface
+// Source implements LabelSource.
 type Source struct{}
 
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return nil }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return nil }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(source.Config) {}
 
-func (s Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	// Check if any iommu devices are available
 	devices, err := ioutil.ReadDir(source.SysfsDir.Path("class/iommu/"))
diff --git a/source/kernel/kernel.go b/source/kernel/kernel.go
index d7fc2f4d4..88e8be782 100644
--- a/source/kernel/kernel.go
+++ b/source/kernel/kernel.go
@@ -47,20 +47,20 @@ func newDefaultConfig() *Config {
 	}
 }
 
-// Implement FeatureSource interface
+// Source implements LabelSource.
 type Source struct {
 	config *Config
 }
 
 func (s *Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return s.config }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(conf source.Config) {
 	switch v := conf.(type) {
 	case *Config:
@@ -70,8 +70,8 @@ func (s *Source) SetConfig(conf source.Config) {
 	}
 }
 
-func (s *Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s *Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	// Read kernel version
 	version, err := parseVersion()
diff --git a/source/local/local.go b/source/local/local.go
index 8b196139b..8fc9331f7 100644
--- a/source/local/local.go
+++ b/source/local/local.go
@@ -38,23 +38,23 @@ var (
 	hookDir         = "/etc/kubernetes/node-feature-discovery/source.d/"
 )
 
-// Source implements FeatureSource interface
+// Source implements LabelSource.
 type Source struct{}
 
-// Name returns the name of the feature source
+// Name method of the LabelSource interface
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return nil }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return nil }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(source.Config) {}
 
-// Discover returns features from hooks and files
-func (s Source) Discover() (source.Features, error) {
+// Discover method of the LabelSource interface
+func (s Source) Discover() (source.FeatureLabels, error) {
 	featuresFromHooks, err := getFeaturesFromHooks()
 	if err != nil {
 		klog.Error(err)
@@ -77,8 +77,8 @@ func (s Source) Discover() (source.Features, error) {
 	return featuresFromFiles, nil
 }
 
-func parseFeatures(lines [][]byte, prefix string) source.Features {
-	features := source.Features{}
+func parseFeatures(lines [][]byte, prefix string) source.FeatureLabels {
+	features := source.FeatureLabels{}
 
 	for _, line := range lines {
 		if len(line) > 0 {
@@ -109,8 +109,8 @@ func parseFeatures(lines [][]byte, prefix string) source.Features {
 }
 
 // Run all hooks and get features
-func getFeaturesFromHooks() (source.Features, error) {
-	features := source.Features{}
+func getFeaturesFromHooks() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	files, err := ioutil.ReadDir(hookDir)
 	if err != nil {
@@ -184,8 +184,8 @@ func runHook(file string) ([][]byte, error) {
 }
 
 // Read all files to get features
-func getFeaturesFromFiles() (source.Features, error) {
-	features := source.Features{}
+func getFeaturesFromFiles() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	files, err := ioutil.ReadDir(featureFilesDir)
 	if err != nil {
diff --git a/source/memory/memory.go b/source/memory/memory.go
index 8669303d3..4311171ae 100644
--- a/source/memory/memory.go
+++ b/source/memory/memory.go
@@ -28,24 +28,24 @@ import (
 
 const Name = "memory"
 
-// Source implements FeatureSource.
+// Source implements LabelSource.
 type Source struct{}
 
 // Name returns an identifier string for this feature source.
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return nil }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return nil }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(source.Config) {}
 
 // Discover returns feature names for memory: numa if more than one memory node is present.
-func (s Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	// Detect NUMA
 	numa, err := isNuma()
diff --git a/source/mock_FeatureSource.go b/source/mock_LabelSource.go
similarity index 71%
rename from source/mock_FeatureSource.go
rename to source/mock_LabelSource.go
index 21e2fcad3..82d55fdcc 100644
--- a/source/mock_FeatureSource.go
+++ b/source/mock_LabelSource.go
@@ -6,21 +6,21 @@ package source
 
 import mock "github.com/stretchr/testify/mock"
 
-// MockFeatureSource is an autogenerated mock type for the FeatureSource type
-type MockFeatureSource struct {
+// MockLabelSource is an autogenerated mock type for the LabelSource type
+type MockLabelSource struct {
 	mock.Mock
 }
 
 // Discover provides a mock function with given fields:
-func (_m *MockFeatureSource) Discover() (Features, error) {
+func (_m *MockLabelSource) Discover() (FeatureLabels, error) {
 	ret := _m.Called()
 
-	var r0 Features
-	if rf, ok := ret.Get(0).(func() Features); ok {
+	var r0 FeatureLabels
+	if rf, ok := ret.Get(0).(func() FeatureLabels); ok {
 		r0 = rf()
 	} else {
 		if ret.Get(0) != nil {
-			r0 = ret.Get(0).(Features)
+			r0 = ret.Get(0).(FeatureLabels)
 		}
 	}
 
@@ -35,7 +35,7 @@ func (_m *MockFeatureSource) Discover() (Features, error) {
 }
 
 // GetConfig provides a mock function with given fields:
-func (_m *MockFeatureSource) GetConfig() Config {
+func (_m *MockLabelSource) GetConfig() Config {
 	ret := _m.Called()
 
 	var r0 Config
@@ -51,7 +51,7 @@ func (_m *MockFeatureSource) GetConfig() Config {
 }
 
 // Name provides a mock function with given fields:
-func (_m *MockFeatureSource) Name() string {
+func (_m *MockLabelSource) Name() string {
 	ret := _m.Called()
 
 	var r0 string
@@ -65,7 +65,7 @@ func (_m *MockFeatureSource) Name() string {
 }
 
 // NewConfig provides a mock function with given fields:
-func (_m *MockFeatureSource) NewConfig() Config {
+func (_m *MockLabelSource) NewConfig() Config {
 	ret := _m.Called()
 
 	var r0 Config
@@ -81,6 +81,6 @@ func (_m *MockFeatureSource) NewConfig() Config {
 }
 
 // SetConfig provides a mock function with given fields: _a0
-func (_m *MockFeatureSource) SetConfig(_a0 Config) {
+func (_m *MockLabelSource) SetConfig(_a0 Config) {
 	_m.Called(_a0)
 }
diff --git a/source/network/network.go b/source/network/network.go
index b8c941bbf..9a1748722 100644
--- a/source/network/network.go
+++ b/source/network/network.go
@@ -41,24 +41,24 @@ const (
 
 const sysfsBaseDir = "class/net"
 
-// Source implements FeatureSource.
+// Source implements LabelSource.
 type Source struct{}
 
 // Name returns an identifier string for this feature source.
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return nil }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return nil }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(source.Config) {}
 
 // Discover returns feature names sriov-configured and sriov if SR-IOV capable NICs are present and/or SR-IOV virtual functions are configured on the node
-func (s Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	netInterfaces, err := ioutil.ReadDir(source.SysfsDir.Path(sysfsBaseDir))
 	if err != nil {
diff --git a/source/pci/pci.go b/source/pci/pci.go
index c78da29c9..a68f270ae 100644
--- a/source/pci/pci.go
+++ b/source/pci/pci.go
@@ -41,7 +41,7 @@ func newDefaultConfig() *Config {
 	}
 }
 
-// Source implements FeatureSource interface
+// Source implements LabelSource.
 type Source struct {
 	config *Config
 }
@@ -49,13 +49,13 @@ type Source struct {
 // Name returns the name of the feature source
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return s.config }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(conf source.Config) {
 	switch v := conf.(type) {
 	case *Config:
@@ -66,8 +66,8 @@ func (s *Source) SetConfig(conf source.Config) {
 }
 
 // Discover features
-func (s Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	// Construct a device label format, a sorted list of valid attributes
 	deviceLabelFields := []string{}
diff --git a/source/source.go b/source/source.go
index edd51449f..d70e10983 100644
--- a/source/source.go
+++ b/source/source.go
@@ -16,18 +16,19 @@ limitations under the License.
 
 package source
 
-// Value of a feature
-type FeatureValue interface{}
+// FeatureLabelValue represents the value of one feature label
+type FeatureLabelValue interface{}
 
-type Features map[string]FeatureValue
+// FeatureLabels is a collection of feature labels
+type FeatureLabels map[string]FeatureLabelValue
 
-// FeatureSource represents a source of a discovered node feature.
-type FeatureSource interface {
-	// Name returns a friendly name for this source of node feature.
+// LabelSource represents a source of node feature labels
+type LabelSource interface {
+	// Name returns a friendly name for this source
 	Name() string
 
-	// Discover returns discovered features for this node.
-	Discover() (Features, error)
+	// Discover returns discovered feature labels
+	Discover() (FeatureLabels, error)
 
 	// NewConfig returns a new default config of the source
 	NewConfig() Config
@@ -39,5 +40,6 @@ type FeatureSource interface {
 	SetConfig(Config)
 }
 
+// Config is the generic interface for source configuration data
 type Config interface {
 }
diff --git a/source/storage/storage.go b/source/storage/storage.go
index f0c5dec5f..a2ae032fc 100644
--- a/source/storage/storage.go
+++ b/source/storage/storage.go
@@ -25,24 +25,24 @@ import (
 
 const Name = "storage"
 
-// Source implements FeatureSource.
+// Source implements LabelSource.
 type Source struct{}
 
 // Name returns an identifier string for this feature source.
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return nil }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return nil }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(source.Config) {}
 
 // Discover returns feature names for storage: nonrotationaldisk if any SSD drive present.
-func (s Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	// Check if there is any non-rotational block devices attached to the node
 	blockdevices, err := ioutil.ReadDir(source.SysfsDir.Path("block"))
diff --git a/source/system/system.go b/source/system/system.go
index 59b397036..889aa8ceb 100644
--- a/source/system/system.go
+++ b/source/system/system.go
@@ -34,22 +34,22 @@ var osReleaseFields = [...]string{
 
 const Name = "system"
 
-// Implement FeatureSource interface
+// Source implements LabelSource.
 type Source struct{}
 
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return nil }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return nil }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(source.Config) {}
 
-func (s Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	release, err := parseOSRelease()
 	if err != nil {
diff --git a/source/usb/usb.go b/source/usb/usb.go
index 0d386612b..81b8003ef 100644
--- a/source/usb/usb.go
+++ b/source/usb/usb.go
@@ -44,7 +44,7 @@ func newDefaultConfig() *Config {
 	}
 }
 
-// Source implements FeatureSource interface
+// Source implements LabelSource.
 type Source struct {
 	config *Config
 }
@@ -52,13 +52,13 @@ type Source struct {
 // Name returns the name of the feature source
 func (s Source) Name() string { return Name }
 
-// NewConfig method of the FeatureSource interface
+// NewConfig method of the LabelSource interface
 func (s *Source) NewConfig() source.Config { return newDefaultConfig() }
 
-// GetConfig method of the FeatureSource interface
+// GetConfig method of the LabelSource interface
 func (s *Source) GetConfig() source.Config { return s.config }
 
-// SetConfig method of the FeatureSource interface
+// SetConfig method of the LabelSource interface
 func (s *Source) SetConfig(conf source.Config) {
 	switch v := conf.(type) {
 	case *Config:
@@ -69,8 +69,8 @@ func (s *Source) SetConfig(conf source.Config) {
 }
 
 // Discover features
-func (s Source) Discover() (source.Features, error) {
-	features := source.Features{}
+func (s Source) Discover() (source.FeatureLabels, error) {
+	features := source.FeatureLabels{}
 
 	// Construct a device label format, a sorted list of valid attributes
 	deviceLabelFields := []string{}


Test patch:
diff --git a/pkg/nfd-client/worker/nfd-worker-internal_test.go b/pkg/nfd-client/worker/nfd-worker-internal_test.go
index 4bc3f2091..d2255cb9b 100644
--- a/pkg/nfd-client/worker/nfd-worker-internal_test.go
+++ b/pkg/nfd-client/worker/nfd-worker-internal_test.go
@@ -38,26 +38,26 @@ import (
 	"sigs.k8s.io/node-feature-discovery/source/pci"
 )
 
-const fakeFeatureSourceName string = "testSource"
+const fakeLabelSourceName string = "testSource"
 
 func TestDiscoveryWithMockSources(t *testing.T) {
 	Convey("When I discover features from fake source and update the node using fake client", t, func() {
-		mockFeatureSource := new(source.MockFeatureSource)
+		mockLabelSource := new(source.MockLabelSource)
 		allFeatureNames := []string{"testfeature1", "testfeature2", "test.ns/test", "test.ns/foo", "/no-ns-label", "invalid/test/feature"}
 		whiteListFeatureNames := []string{"testfeature1", "testfeature2", "test.ns/test"}
 
 		fakeFeatures, _ := makeFakeFeatures(allFeatureNames)
 		_, fakeFeatureLabels := makeFakeFeatures(whiteListFeatureNames)
 
-		fakeFeatureSource := source.FeatureSource(mockFeatureSource)
+		fakeLabelSource := source.LabelSource(mockLabelSource)
 
 		labelWhiteList := utils.RegexpVal{Regexp: *regexp.MustCompile("^test")}
 
 		Convey("When I successfully get the labels from the mock source", func() {
-			mockFeatureSource.On("Name").Return(fakeFeatureSourceName)
-			mockFeatureSource.On("Discover").Return(fakeFeatures, nil)
+			mockLabelSource.On("Name").Return(fakeLabelSourceName)
+			mockLabelSource.On("Discover").Return(fakeFeatures, nil)
 
-			returnedLabels, err := getFeatureLabels(fakeFeatureSource, labelWhiteList.Regexp)
+			returnedLabels, err := getFeatureLabels(fakeLabelSource, labelWhiteList.Regexp)
 			Convey("Proper label is returned", func() {
 				So(returnedLabels, ShouldResemble, fakeFeatureLabels)
 			})
@@ -68,9 +68,9 @@ func TestDiscoveryWithMockSources(t *testing.T) {
 
 		Convey("When I fail to get the labels from the mock source", func() {
 			expectedError := errors.New("fake error")
-			mockFeatureSource.On("Discover").Return(nil, expectedError)
+			mockLabelSource.On("Discover").Return(nil, expectedError)
 
-			returnedLabels, err := getFeatureLabels(fakeFeatureSource, labelWhiteList.Regexp)
+			returnedLabels, err := getFeatureLabels(fakeLabelSource, labelWhiteList.Regexp)
 			Convey("No label is returned", func() {
 				So(returnedLabels, ShouldBeNil)
 			})
@@ -81,12 +81,12 @@ func TestDiscoveryWithMockSources(t *testing.T) {
 	})
 }
 
-func makeFakeFeatures(names []string) (source.Features, Labels) {
-	features := source.Features{}
+func makeFakeFeatures(names []string) (source.FeatureLabels, Labels) {
+	features := source.FeatureLabels{}
 	labels := Labels{}
 	for _, f := range names {
 		features[f] = true
-		labelName := fakeFeatureSourceName + "-" + f
+		labelName := fakeLabelSourceName + "-" + f
 		if strings.IndexByte(f, '/') >= 0 {
 			labelName = f
 		}
@@ -96,7 +96,7 @@ func makeFakeFeatures(names []string) (source.Features, Labels) {
 	return features, labels
 }
 
-func (w *nfdWorker) getSource(name string) source.FeatureSource {
+func (w *nfdWorker) getSource(name string) source.LabelSource {
 	for _, s := range w.realSources {
 		if s.Name() == name {
 			return s
@@ -356,9 +356,9 @@ func TestNewNfdWorker(t *testing.T) {
 
 func TestCreateFeatureLabels(t *testing.T) {
 	Convey("When creating feature labels from the configured sources", t, func() {
-		fakeFeatureSource := source.FeatureSource(new(fake.Source))
-		fakeFeatureSource.SetConfig(fakeFeatureSource.NewConfig())
-		sources := []source.FeatureSource{fakeFeatureSource}
+		fakeLabelSource := source.LabelSource(new(fake.Source))
+		fakeLabelSource.SetConfig(fakeLabelSource.NewConfig())
+		sources := []source.LabelSource{fakeLabelSource}
 
 		Convey("When fake feature source is configured", func() {
 			emptyLabelWL := regexp.MustCompile("")