Skip to content

Commit df21d77

Browse files
committed
logger: fix default event subscription mask.
Let the stub determine which events the logger plugin subscribes to. This should fix startup errors about trying to subscribe to {Post,}UpdatePodSandbox events without handlers. Once the runtimes start delivering those events we can add handlers for them and that will get us subscribed to them automatically. Signed-off-by: Krisztian Litkey <[email protected]>
1 parent 20533ae commit df21d77

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plugins/logger/nri-logger.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func main() {
215215

216216
flag.StringVar(&pluginName, "name", "", "plugin name to register to NRI")
217217
flag.StringVar(&pluginIdx, "idx", "", "plugin index to register to NRI")
218-
flag.StringVar(&events, "events", "all", "comma-separated list of events to subscribe for")
218+
flag.StringVar(&events, "events", "", "comma-separated list of events to subscribe for")
219219
flag.StringVar(&cfg.LogFile, "log-file", "", "logfile name, if logging to a file")
220220
flag.StringVar(&cfg.AddAnnotation, "add-annotation", "", "add this annotation to containers")
221221
flag.StringVar(&cfg.SetAnnotation, "set-annotation", "", "set this annotation on containers")
@@ -239,8 +239,10 @@ func main() {
239239
}
240240

241241
p := &plugin{}
242-
if p.mask, err = api.ParseEventMask(events); err != nil {
243-
log.Fatalf("failed to parse events: %v", err)
242+
if events != "" {
243+
if p.mask, err = api.ParseEventMask(events); err != nil {
244+
log.Fatalf("failed to parse events: %v", err)
245+
}
244246
}
245247
cfg.Events = strings.Split(events, ",")
246248

0 commit comments

Comments
 (0)