Skip to content

Commit a248e2a

Browse files
committed
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.
1 parent 53ee78d commit a248e2a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmd/options/options.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ func (npdo *NodeProblemDetectorOptions) ValidOrDie() {
8080
panic(fmt.Sprintf("apiserver-override %q is not a valid HTTP URI: %v",
8181
npdo.ApiServerOverride, err))
8282
}
83+
if len(npdo.SystemLogMonitorConfigPaths) == 0 && len(npdo.CustomPluginMonitorConfigPaths) == 0 {
84+
panic(fmt.Sprintf("Either --system-log-monitors or --custom-plugin-monitors is required"))
85+
}
8386
}
8487

8588
// SetNodeNameOrDie sets `NodeName` field with valid value.

0 commit comments

Comments
 (0)