Skip to content

Commit

Permalink
resmgr: warn about obsolete command line argument.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
klihub committed Nov 15, 2024
1 parent 0000b06 commit 44038c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
22 changes: 9 additions & 13 deletions pkg/resmgr/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.")
}
6 changes: 6 additions & 0 deletions pkg/resmgr/resource-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 44038c0

Please sign in to comment.