Skip to content
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

feat(monitor): add an events channel to avoid event loss caused by delayed docker event processing #1930

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

slashexx
Copy link

@slashexx slashexx commented Jan 1, 2025

Purpose of PR?:

Fixes #1929

Does this PR introduce a breaking change?
No

If the changes in this PR are manually verified, list down the scenarios covered::

Additional information for reviewer? :
This PR addresses the Docker event queue buffer issue by adding processing logic in dockerHandler.go. It is part of improving KubeArmor's ability to handle high-frequency Docker events efficiently.

Checklist:

@slashexx slashexx changed the title feat(monitor): add a buffered events channel to avoid event loss caused by delayed docker event processing feat(monitor): add a buffered channel to avoid event loss caused by delayed docker event processing Jan 1, 2025
@slashexx slashexx changed the title feat(monitor): add a buffered channel to avoid event loss caused by delayed docker event processing feat(monitor): add an events channel to avoid event loss caused by delayed docker event processing Jan 1, 2025
Copy link
Collaborator

@rksharma95 rksharma95 left a comment

Choose a reason for hiding this comment

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

@slashexx Thanks for the PR, rest LGTM, just a few comments from my side. let me know wdyt?

@@ -218,10 +218,23 @@ func (dh *DockerHandler) GetContainerInfo(containerID string, OwnerInfo map[stri
// GetEventChannel Function
func (dh *DockerHandler) GetEventChannel() <-chan events.Message {
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's pass and use the StopChan to handle the stop signal here and also pass the cancellable context to to dockerclient.

case <-StopChan:

types.EventsOptions has been deprecated in latest, can we handle that as well? thanks

Copy link
Author

Choose a reason for hiding this comment

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

@rksharma95 The required changes have been made, PTAL !

@rksharma95
Copy link
Collaborator

@slashexx can you please squash the commits?

Signed-off-by: slashexx <[email protected]>

fix: update event options in Docker event stream to use ListOptions

Signed-off-by: slashexx <[email protected]>

refactor: remove unused import for Docker API types in dockerHandler

Signed-off-by: slashexx <[email protected]>

refactor: update GetEventChannel to accept context and stop channel for better event handling

Signed-off-by: slashexx <[email protected]>
@slashexx
Copy link
Author

@rksharma95 commits have been squashed !

@rksharma95 rksharma95 requested a review from daemon1024 January 21, 2025 06:56
Copy link
Collaborator

@rksharma95 rksharma95 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@slashexx
Copy link
Author

It's been open for a while, gentle ping @Prateeknandle @daemon1024 , is it gtg ?

@daemon1024
Copy link
Member

Hey @slashexx yep it mostly good to go. We currently have code freeze, only fixing bugs for upcoming stable release. We will start reviewing new PRs again after v1.5.1 release. Appreciate the PR!

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.

Add buffer queue processing when a large number of Docker information is updated
3 participants