Merge pull request #33377 from yastij/33371-matchevent-filtering
matching events using ID and name
This commit is contained in:
commit
e56e78976e
|
@ -32,7 +32,6 @@ type controller struct {
|
||||||
adapter *containerAdapter
|
adapter *containerAdapter
|
||||||
closed chan struct{}
|
closed chan struct{}
|
||||||
err error
|
err error
|
||||||
|
|
||||||
pulled chan struct{} // closed after pull
|
pulled chan struct{} // closed after pull
|
||||||
cancelPull func() // cancels pull context if not nil
|
cancelPull func() // cancels pull context if not nil
|
||||||
pullErr error // pull error, only read after pulled closed
|
pullErr error // pull error, only read after pulled closed
|
||||||
|
@ -146,7 +145,6 @@ func (r *controller) Prepare(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.adapter.create(ctx); err != nil {
|
if err := r.adapter.create(ctx); err != nil {
|
||||||
if isContainerCreateNameConflict(err) {
|
if isContainerCreateNameConflict(err) {
|
||||||
if _, err := r.adapter.inspect(ctx); err != nil {
|
if _, err := r.adapter.inspect(ctx); err != nil {
|
||||||
|
@ -564,15 +562,8 @@ func (r *controller) matchevent(event events.Message) bool {
|
||||||
if event.Type != events.ContainerEventType {
|
if event.Type != events.ContainerEventType {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
// we can't filter using id since it will have huge chances to introduce a deadlock. see #33377.
|
||||||
// TODO(stevvooe): Filter based on ID matching, in addition to name.
|
return event.Actor.Attributes["name"] == r.adapter.container.name()
|
||||||
|
|
||||||
// Make sure the events are for this container.
|
|
||||||
if event.Actor.Attributes["name"] != r.adapter.container.name() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *controller) checkClosed() error {
|
func (r *controller) checkClosed() error {
|
||||||
|
|
Loading…
Reference in New Issue