config: removed worker config

All processors will now be used to process the layers.
This commit is contained in:
Sida Chen 2018-09-12 16:15:35 -04:00
parent 53433090a3
commit 0609ed964b
4 changed files with 5 additions and 43 deletions

View File

@ -26,8 +26,6 @@ import (
"github.com/coreos/clair" "github.com/coreos/clair"
"github.com/coreos/clair/api" "github.com/coreos/clair/api"
"github.com/coreos/clair/database" "github.com/coreos/clair/database"
"github.com/coreos/clair/ext/featurefmt"
"github.com/coreos/clair/ext/featurens"
"github.com/coreos/clair/ext/notification" "github.com/coreos/clair/ext/notification"
"github.com/coreos/clair/ext/vulnsrc" "github.com/coreos/clair/ext/vulnsrc"
"github.com/coreos/clair/pkg/pagination" "github.com/coreos/clair/pkg/pagination"
@ -47,7 +45,6 @@ type File struct {
type Config struct { type Config struct {
Database database.RegistrableComponentConfig Database database.RegistrableComponentConfig
Updater *clair.UpdaterConfig Updater *clair.UpdaterConfig
Worker *clair.WorkerConfig
Notifier *notification.Config Notifier *notification.Config
API *api.Config API *api.Config
} }
@ -62,10 +59,6 @@ func DefaultConfig() Config {
EnabledUpdaters: vulnsrc.ListUpdaters(), EnabledUpdaters: vulnsrc.ListUpdaters(),
Interval: 1 * time.Hour, Interval: 1 * time.Hour,
}, },
Worker: &clair.WorkerConfig{
EnabledDetectors: featurens.ListDetectors(),
EnabledListers: featurefmt.ListListers(),
},
API: &api.Config{ API: &api.Config{
HealthAddr: "0.0.0.0:6061", HealthAddr: "0.0.0.0:6061",
Addr: "0.0.0.0:6060", Addr: "0.0.0.0:6060",

View File

@ -112,29 +112,16 @@ func configClairVersion(config *Config) {
"Updaters": strings.Join(updaters, ","), "Updaters": strings.Join(updaters, ","),
}).Info("Clair registered components") }).Info("Clair registered components")
unregDetectors := strutil.CompareStringLists(config.Worker.EnabledDetectors, detectors)
unregListers := strutil.CompareStringLists(config.Worker.EnabledListers, listers)
unregUpdaters := strutil.CompareStringLists(config.Updater.EnabledUpdaters, updaters) unregUpdaters := strutil.CompareStringLists(config.Updater.EnabledUpdaters, updaters)
if len(unregDetectors) != 0 || len(unregListers) != 0 || len(unregUpdaters) != 0 { if len(unregUpdaters) != 0 {
log.WithFields(log.Fields{ log.WithFields(log.Fields{
"Unknown Detectors": strings.Join(unregDetectors, ","),
"Unknown Listers": strings.Join(unregListers, ","),
"Unknown Updaters": strings.Join(unregUpdaters, ","), "Unknown Updaters": strings.Join(unregUpdaters, ","),
"Available Listers": strings.Join(featurefmt.ListListers(), ","),
"Available Detectors": strings.Join(featurens.ListDetectors(), ","),
"Available Updaters": strings.Join(vulnsrc.ListUpdaters(), ","), "Available Updaters": strings.Join(vulnsrc.ListUpdaters(), ","),
}).Fatal("Unknown or unregistered components are configured") }).Fatal("Unknown or unregistered components are configured")
} }
// verify the user specified detectors/listers/updaters are implemented. If // All listers and detectors are enabled.
// some are not registered, it logs warning and won't use the unregistered clair.Processors = database.Processors{Detectors: detectors, Listers: listers}
// extensions.
clair.Processors = database.Processors{
Detectors: strutil.CompareStringListsInBoth(config.Worker.EnabledDetectors, detectors),
Listers: strutil.CompareStringListsInBoth(config.Worker.EnabledListers, listers),
}
clair.EnabledUpdaters = strutil.CompareStringListsInBoth(config.Updater.EnabledUpdaters, updaters) clair.EnabledUpdaters = strutil.CompareStringListsInBoth(config.Updater.EnabledUpdaters, updaters)
} }

View File

@ -51,19 +51,6 @@ clair:
keyfile: keyfile:
certfile: certfile:
worker:
namespace_detectors:
- os-release
- lsb-release
- apt-sources
- alpine-release
- redhat-release
feature_listers:
- apk
- dpkg
- rpm
updater: updater:
# Frequency the database will be updated with vulnerabilities from the default data sources # Frequency the database will be updated with vulnerabilities from the default data sources
# The value 0 disables the updater entirely. # The value 0 disables the updater entirely.

View File

@ -52,11 +52,6 @@ var (
Processors database.Processors Processors database.Processors
) )
type WorkerConfig struct {
EnabledDetectors []string `yaml:"namespace_detectors"`
EnabledListers []string `yaml:"feature_listers"`
}
// LayerRequest represents all information necessary to download and process a // LayerRequest represents all information necessary to download and process a
// layer. // layer.
type LayerRequest struct { type LayerRequest struct {