1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-16 13:28:18 +00:00

source: rename TestSource to SupplementalSource

Just widen the scope in terms of naming, to cover deprecated and/or
experimental sources too, for example.
This commit is contained in:
Markus Lehtonen 2021-11-26 11:22:39 +02:00
parent 09c1ff86ca
commit a6eddbab4f
3 changed files with 11 additions and 8 deletions

View file

@ -302,7 +302,7 @@ func (w *nfdWorker) configureCore(c coreConfig) error {
for _, name := range c.FeatureSources { for _, name := range c.FeatureSources {
if name == "all" { if name == "all" {
for n, s := range source.GetAllFeatureSources() { for n, s := range source.GetAllFeatureSources() {
if ts, ok := s.(source.TestSource); !ok || !ts.IsTestSource() { if ts, ok := s.(source.SupplementalSource); !ok || !ts.DisableByDefault() {
featureSources[n] = s featureSources[n] = s
} }
} }
@ -337,7 +337,7 @@ func (w *nfdWorker) configureCore(c coreConfig) error {
for _, name := range c.LabelSources { for _, name := range c.LabelSources {
if name == "all" { if name == "all" {
for n, s := range source.GetAllLabelSources() { for n, s := range source.GetAllLabelSources() {
if ts, ok := s.(source.TestSource); !ok || !ts.IsTestSource() { if ts, ok := s.(source.SupplementalSource); !ok || !ts.DisableByDefault() {
labelSources[n] = s labelSources[n] = s
} }
} }

View file

@ -148,8 +148,8 @@ func (s *fakeSource) GetLabels() (source.FeatureLabels, error) {
return labels, nil return labels, nil
} }
// IsTestSource method of the LabelSource interface // DisableByDefault method of the SupplementalSource interface.
func (s *fakeSource) IsTestSource() bool { return true } func (s *fakeSource) DisableByDefault() bool { return true }
func init() { func init() {
source.Register(&src) source.Register(&src)

View file

@ -66,12 +66,15 @@ type ConfigurableSource interface {
SetConfig(Config) SetConfig(Config)
} }
// TestSource represents a source purposed for testing only // SupplementalSource represents a source that does not belong to the core set
type TestSource interface { // sources to be used in production, e.g. is deprecated, very experimental or
// purposed for testing only.
type SupplementalSource interface {
Source Source
// IsTestSource returns true if the source is not for production // DisableByDefault returns true if the source should be disabled by
IsTestSource() bool // default in production.
DisableByDefault() bool
} }
// FeatureLabelValue represents the value of one feature label // FeatureLabelValue represents the value of one feature label