mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-02-14 18:09:57 +00:00
Add validation for the required flag
If --system-log-monitors or --custom-plugin-monitors are not specified, npd gave us unclear message. This patch adds the validation and clear error message.
This commit is contained in:
@@ -80,6 +80,9 @@ func (npdo *NodeProblemDetectorOptions) ValidOrDie() {
|
||||
panic(fmt.Sprintf("apiserver-override %q is not a valid HTTP URI: %v",
|
||||
npdo.ApiServerOverride, err))
|
||||
}
|
||||
if len(npdo.SystemLogMonitorConfigPaths) == 0 && len(npdo.CustomPluginMonitorConfigPaths) == 0 {
|
||||
panic(fmt.Sprintf("Either --system-log-monitors or --custom-plugin-monitors is required"))
|
||||
}
|
||||
}
|
||||
|
||||
// SetNodeNameOrDie sets `NodeName` field with valid value.
|
||||
|
||||
Reference in New Issue
Block a user