From 53cc3597b4d41e18a02ea461aa93d5dd8a1cff71 Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Mon, 11 Nov 2024 22:15:50 +0200 Subject: [PATCH] resmgr: warn about obsolete command line argument. Remove obsolete and unused option entries. Give a warning about using the now-obsolete '-metrics-interval' argument. It's used unconditionally by our existing Helm charts, so we'll phase it out a bit more gently. Signed-off-by: Krisztian Litkey --- pkg/resmgr/flags.go | 22 +++++++++------------- pkg/resmgr/resource-manager.go | 6 ++++++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/pkg/resmgr/flags.go b/pkg/resmgr/flags.go index 88f7bdf08..9270700a9 100644 --- a/pkg/resmgr/flags.go +++ b/pkg/resmgr/flags.go @@ -29,18 +29,13 @@ const ( // Options captures our command line parameters. type options struct { - HostRoot string - StateDir string - PidFile string - ResctrlPath string - FallbackConfig string - ForceConfig string - ForceConfigSignal string - MetricsTimer time.Duration - RebalanceTimer time.Duration - NriPluginName string - NriPluginIdx string - NriSocket string + HostRoot string + StateDir string + PidFile string + MetricsTimer time.Duration + NriPluginName string + NriPluginIdx string + NriSocket string } // ResourceManager command line options. @@ -60,7 +55,8 @@ func init() { flag.StringVar(&opt.PidFile, "pid-file", pidfile.GetPath(), "PID file to write daemon PID to") flag.DurationVar(&opt.MetricsTimer, "metrics-interval", 0, - "Interval for polling/gathering runtime metrics data. Use 'disable' for disabling.") + "Obsolete way to set interval for polling/gathering runtime metrics data.\n"+ + "Use the instrumentation section of the CR-based configuration interface instead.") flag.StringVar(&opt.StateDir, "state-dir", "/var/lib/nri-resource-policy", "Permanent storage directory path for the resource manager to store its state in.") } diff --git a/pkg/resmgr/resource-manager.go b/pkg/resmgr/resource-manager.go index 948ced007..b3b4e5054 100644 --- a/pkg/resmgr/resource-manager.go +++ b/pkg/resmgr/resource-manager.go @@ -80,6 +80,12 @@ func NewResourceManager(backend policy.Backend, agt *agent.Agent) (ResourceManag goresctrlpath.SetPrefix(opt.HostRoot) } + if opt.MetricsTimer != 0 { + log.Warn("WARNING: obsolete metrics-interval flag given, ignoring...") + log.Warn("WARNING: use the CR-based configuration interface instead") + log.Warn("WARNING: this flag will be removed in a future release") + } + m := &resmgr{ agent: agt, }