Add multi-subscriber support to GetContainerEvents CRI API
This commit addresses issue #7318 by introducing events broadcasting to the current implementation. The integration/container_event_test.go is extended to demonstrate the broadcasting capabilities of two simultaneous connected clients. Signed-off-by: Yury Gargay <yury.gargay@gmail.com>
This commit is contained in:
committed by
Derek McGowan
parent
e7eb08eb56
commit
2e8e03389c
@@ -63,6 +63,7 @@ const (
|
||||
|
||||
var (
|
||||
runtimeService cri.RuntimeService
|
||||
runtimeService2 cri.RuntimeService // to test GetContainerEvents broadcast
|
||||
imageService cri.ImageManagerService
|
||||
containerdClient *containerd.Client
|
||||
containerdEndpoint string
|
||||
@@ -87,6 +88,10 @@ func ConnectDaemons() error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create runtime service: %w", err)
|
||||
}
|
||||
runtimeService2, err = remote.NewRuntimeService(*criEndpoint, timeout)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create runtime service: %w", err)
|
||||
}
|
||||
imageService, err = remote.NewImageService(*criEndpoint, timeout)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create image service: %w", err)
|
||||
@@ -98,6 +103,10 @@ func ConnectDaemons() error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list containers: %w", err)
|
||||
}
|
||||
_, err = runtimeService2.ListContainers(&runtime.ContainerFilter{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list containers: %w", err)
|
||||
}
|
||||
_, err = imageService.ListImages(&runtime.ImageFilter{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list images: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user