mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-28 01:47:20 +00:00
enabled and fixed the errcheck linter rule
This commit is contained in:
@@ -106,13 +106,17 @@ func NewNodeProblemDetectorOptions() *NodeProblemDetectorOptions {
|
||||
}
|
||||
|
||||
// AddFlags adds node problem detector command line options to pflag.
|
||||
func (npdo *NodeProblemDetectorOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
func (npdo *NodeProblemDetectorOptions) AddFlags(fs *pflag.FlagSet) error {
|
||||
fs.StringSliceVar(&npdo.SystemLogMonitorConfigPaths, "system-log-monitors",
|
||||
[]string{}, "List of paths to system log monitor config files, comma separated.")
|
||||
fs.MarkDeprecated("system-log-monitors", "replaced by --config.system-log-monitor. NPD will panic if both --system-log-monitors and --config.system-log-monitor are set.")
|
||||
if err := fs.MarkDeprecated("system-log-monitors", "replaced by --config.system-log-monitor. NPD will panic if both --system-log-monitors and --config.system-log-monitor are set."); err != nil {
|
||||
return fmt.Errorf("failed to mark 'system-log-monitors' as deprecated: %w", err)
|
||||
}
|
||||
fs.StringSliceVar(&npdo.CustomPluginMonitorConfigPaths, "custom-plugin-monitors",
|
||||
[]string{}, "List of paths to custom plugin monitor config files, comma separated.")
|
||||
fs.MarkDeprecated("custom-plugin-monitors", "replaced by --config.custom-plugin-monitor. NPD will panic if both --custom-plugin-monitors and --config.custom-plugin-monitor are set.")
|
||||
if err := fs.MarkDeprecated("custom-plugin-monitors", "replaced by --config.custom-plugin-monitor. NPD will panic if both --custom-plugin-monitors and --config.custom-plugin-monitor are set."); err != nil {
|
||||
return fmt.Errorf("failed to mark 'custom-plugin-monitors' as deprecated: %w", err)
|
||||
}
|
||||
fs.BoolVar(&npdo.EnableK8sExporter, "enable-k8s-exporter", true, "Enables reporting to Kubernetes API server.")
|
||||
fs.StringVar(&npdo.EventNamespace, "event-namespace", "", "Namespace for recorded Kubernetes events.")
|
||||
fs.StringVar(&npdo.ApiServerOverride, "apiserver-override",
|
||||
@@ -149,6 +153,7 @@ func (npdo *NodeProblemDetectorOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
problemDaemonName,
|
||||
problemdaemon.GetProblemDaemonHandlerOrDie(problemDaemonName).CmdOptionDescription))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ValidOrDie validates node problem detector command line options.
|
||||
|
||||
Reference in New Issue
Block a user