-
Notifications
You must be signed in to change notification settings - Fork 348
filter events for non k8s.io namespaces #984
Conversation
pkg/server/events.go
Outdated
@@ -198,6 +198,11 @@ func (em *eventMonitor) handleEvent(any interface{}) error { | |||
e := any.(*eventtypes.TaskExit) | |||
logrus.Infof("TaskExit event %+v", e) | |||
// Use ID instead of ContainerID to rule out TaskExit event for exec. | |||
if e.ID == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I think current logic can handle this case, and firecracker should have ID here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would handle it, but is that a requirement that we should force on all containers created in containerd?
Would be nice to have a namespace filter on these events I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the behavior should be equivalent to does not exist, vs error prefix is invalid..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we don't need this.
If we want to consider empty string, we should do it for sandbox/container and image for consistency, which i feel like is not that necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's at least keep this PR only add the namespace filter for easy cherrypick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.. the filter for namespace will be enough..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sigh.. so the subscriptions return any events that match, so we could request any for our namespace or any for the ones we already subscribe to, but it does not filter out by namespace unless that is the only filter used.
pkg/server/events.go
Outdated
@@ -198,6 +198,11 @@ func (em *eventMonitor) handleEvent(any interface{}) error { | |||
e := any.(*eventtypes.TaskExit) | |||
logrus.Infof("TaskExit event %+v", e) | |||
// Use ID instead of ContainerID to rule out TaskExit event for exec. | |||
if e.ID == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's at least keep this PR only add the namespace filter for easy cherrypick
pkg/server/events.go
Outdated
@@ -98,6 +99,7 @@ func (em *eventMonitor) subscribe(subscriber events.Subscriber) { | |||
`topic=="/tasks/exit"`, | |||
`topic=="/tasks/oom"`, | |||
`topic~="/images/"`, | |||
`namespace==` + constants.K8sContainerdNamespace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add double quote for the namespace for consistency.
Actually I can't find a document for this immediately, let's keep it the same with the previous code to make sure it works.
fmt.Sprintf(namespace=="%s"
, constants.K8sContainerdNamespace)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to switch to manual filter on our side..
/lgtm And we should cherrypick |
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
New changes are detected. LGTM label has been removed. |
apply lgtm.. only cleaned up the comments.. |
some examples.. works good:
|
…06d9200e95 includes backports of: - containerd/cri#984 filter events for non k8s.io namespaces (resolves firecracker-microvm/firecracker-containerd#35) - containerd/cri#991 Remove container lifecycle image dependency (fixes containerd/cri#990) - containerd/cri#1016 [release/1.0] Specify platform for image pull (fixes containerd/cri#1015) - containerd/cri#1027 Fix the log ending newline handling (fixes containerd/cri#1026) - containerd/cri#1042 Set /etc/hostname (fixes containerd/cri#1041) - containerd/cri#1045 Fix env performance issue (fixes containerd/cri#1044) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Resolve issue firecracker-microvm/firecracker-containerd#35
Signed-off-by: Mike Brown brownwm@us.ibm.com