mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
nfd-worker: introduce -label-sources cmdline flag
Useful for development, testing and debugging.
This commit is contained in:
parent
773280de65
commit
77a6b27583
2 changed files with 8 additions and 4 deletions
|
@ -80,6 +80,8 @@ func parseArgs(flags *flag.FlagSet, osArgs ...string) *worker.Args {
|
|||
switch f.Name {
|
||||
case "no-publish":
|
||||
args.Overrides.NoPublish = overrides.NoPublish
|
||||
case "label-sources":
|
||||
args.Overrides.LabelSources = overrides.LabelSources
|
||||
case "label-whitelist":
|
||||
klog.Warningf("-label-whitelist is deprecated, use 'core.labelWhiteList' option in the config file, instead")
|
||||
args.Overrides.LabelWhiteList = overrides.LabelWhiteList
|
||||
|
@ -87,7 +89,7 @@ func parseArgs(flags *flag.FlagSet, osArgs ...string) *worker.Args {
|
|||
klog.Warningf("-sleep-interval is deprecated, use 'core.sleepInterval' option in the config file, instead")
|
||||
args.Overrides.SleepInterval = overrides.SleepInterval
|
||||
case "sources":
|
||||
klog.Warningf("-sources is deprecated, use 'core.sources' option in the config file, instead")
|
||||
klog.Warningf("-sources is deprecated, use '-label-sources' flag, instead")
|
||||
args.Overrides.LabelSources = overrides.LabelSources
|
||||
}
|
||||
})
|
||||
|
@ -125,6 +127,8 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs)
|
|||
}
|
||||
overrides.NoPublish = flagset.Bool("no-publish", false,
|
||||
"Do not publish discovered features, disable connection to nfd-master.")
|
||||
flagset.Var(overrides.LabelSources, "label-sources",
|
||||
"Comma separated list of label sources. Special value 'all' enables all feature sources.")
|
||||
flagset.Var(overrides.LabelWhiteList, "label-whitelist",
|
||||
"Regular expression to filter label names to publish to the Kubernetes API server. "+
|
||||
"NB: the label namespace is omitted i.e. the filter is only applied to the name part after '/'. "+
|
||||
|
@ -133,8 +137,8 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs)
|
|||
"Time to sleep between re-labeling. Non-positive value implies no re-labeling (i.e. infinite sleep). "+
|
||||
"DEPRECATED: This parameter should be set via the config file")
|
||||
flagset.Var(overrides.LabelSources, "sources",
|
||||
"Comma separated list of feature sources. Special value 'all' enables all feature sources. "+
|
||||
"DEPRECATED: This parameter should be set via the config file")
|
||||
"Comma separated list of label sources. Special value 'all' enables all feature sources. "+
|
||||
"DEPRECATED: use -label-sources instead")
|
||||
|
||||
return args, overrides
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func TestParseArgs(t *testing.T) {
|
|||
args := parseArgs(flags,
|
||||
"-no-publish",
|
||||
"-label-whitelist=.*rdt.*",
|
||||
"-sources=fake1,fake2,fake3",
|
||||
"-label-sources=fake1,fake2,fake3",
|
||||
"-sleep-interval=30s")
|
||||
|
||||
Convey("args.sources is set to appropriate values", func() {
|
||||
|
|
Loading…
Reference in a new issue