1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +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 {
if name == "all" {
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
}
}
@ -337,7 +337,7 @@ func (w *nfdWorker) configureCore(c coreConfig) error {
for _, name := range c.LabelSources {
if name == "all" {
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
}
}

View file

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

View file

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