Skip to content

plugins/logger: fix default event subscription mask. #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

klihub
Copy link
Member

@klihub klihub commented Apr 8, 2025

Let the stub determine which events the logger plugin subscribes to, to fix a recently introduced startup failure.

Ever since support for the new pod update events has been merged, unless the event subscription mask is overidden with the --events command line option, the sample logger plugin fails to start up with the following error message:

plugin exited with error internal error: unhandled events UpdatePodSandbox,PostUpdatePodSandbox (0x1800)

This patch should fix that.

@klihub klihub requested review from mikebrow and fuweid April 8, 2025 14:52
@klihub klihub force-pushed the fixes/logger-default-event-mask branch from 54cf552 to 0f9463d Compare April 8, 2025 14:54
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all is still problematic because it filters down to all previously valid/known

maybe add a known option to replace all where that filters out by version / event types we've decided to register for and monitor...

then can make all mean any pod/container ... perhaps later on pod/container/image?

@mikebrow
Copy link
Member

mikebrow commented Apr 8, 2025

should probably add the new pod events

@klihub
Copy link
Member Author

klihub commented Apr 9, 2025

should probably add the new pod events

My plan is to add them once the runtimes start supporting them. Otherwise even with this change in place, we would still fail to register to the runtime, by default, it just would fail on the other end of the ttrpc transport, because those new events are unknown to the runtime yet.

@klihub
Copy link
Member Author

klihub commented Apr 9, 2025

all is still problematic because it filters down to all previously valid/known

maybe add a known option to replace all where that filters out by version / event types we've decided to register for and monitor...

But, if you refer to "all" in

case "all":
, that is a helper function in the API/protocol description, and the idea is that it represents the event mask of all known subscribable NRI events.

Sorry, I don't understand what you mean by filtering out by version. The plugin is compiled against the package, so it is talking/using the same version as the version of the NRI package itself. So the notion of "all" should be the same for the plugin and the NRI package. On the stub side, by convention, using a 0 event mask will result in the stub registering with an event mask for all events the plugin has a handler for. That's what should have been used in the logger plugin by default all along, instead of the default being "all". And that's what this PR aims to fix.

@klihub klihub requested a review from mikebrow April 9, 2025 14:10
@mikebrow
Copy link
Member

mikebrow commented Apr 9, 2025

all is still problematic because it filters down to all previously valid/known
maybe add a known option to replace all where that filters out by version / event types we've decided to register for and monitor...

But, if you refer to "all" in

case "all":

, that is a helper function in the API/protocol description, and the idea is that it represents the event mask of all known subscribable NRI events.
Sorry, I don't understand what you mean by filtering out by version. The plugin is compiled against the package, so it is talking/using the same version as the version of the NRI package itself. So the notion of "all" should be the same for the plugin and the NRI package. On the stub side, by convention, using a 0 event mask will result in the stub registering with an event mask for all events the plugin has a handler for. That's what should have been used in the logger plugin by default all along, instead of the default being "all". And that's what this PR aims to fix.

interesting... so nil is actually all need to read through it better... I caught that all was a mask on known and figured that would need to be versioned... do we block/force NRI plugins to the specific version of containerd/crio vendor import for nri?

I was thinking there was value in the all "known" mask and that each version of NRI will have a set of known

@klihub
Copy link
Member Author

klihub commented Apr 10, 2025

all is still problematic because it filters down to all previously valid/known
maybe add a known option to replace all where that filters out by version / event types we've decided to register for and monitor...

But, if you refer to "all" in

case "all":

, that is a helper function in the API/protocol description, and the idea is that it represents the event mask of all known subscribable NRI events.
Sorry, I don't understand what you mean by filtering out by version. The plugin is compiled against the package, so it is talking/using the same version as the version of the NRI package itself. So the notion of "all" should be the same for the plugin and the NRI package. On the stub side, by convention, using a 0 event mask will result in the stub registering with an event mask for all events the plugin has a handler for. That's what should have been used in the logger plugin by default all along, instead of the default being "all". And that's what this PR aims to fix.

interesting... so nil is actually all need to read through it better... I caught that all was a mask on known and figured that would need to be versioned... do we block/force NRI plugins to the specific version of containerd/crio vendor import for nri?

No, we don't check or block it at the moment. But we reject the plugin if it tries to subscribe to events the runtime does not know about.

I was thinking there was value in the all "known" mask and that each version of NRI will have a set of known

Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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]>
@klihub klihub force-pushed the fixes/logger-default-event-mask branch from 0f9463d to 33b1db1 Compare June 11, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants