diff --git a/cmd/nfd-worker/main.go b/cmd/nfd-worker/main.go index 365e672a9..836505a1c 100644 --- a/cmd/nfd-worker/main.go +++ b/cmd/nfd-worker/main.go @@ -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 } diff --git a/cmd/nfd-worker/main_test.go b/cmd/nfd-worker/main_test.go index 92da940e3..043eedb00 100644 --- a/cmd/nfd-worker/main_test.go +++ b/cmd/nfd-worker/main_test.go @@ -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() {