mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 18:11:22 +00:00
Add support for Evented PLEG
Signed-off-by: Harshal Patil <harpatil@redhat.com> Co-authored-by: Swarup Ghosh <swghosh@redhat.com>
This commit is contained in:
committed by
Swarup Ghosh
parent
7369bd27e0
commit
86284d42f8
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -792,5 +793,25 @@ func (r *remoteRuntimeService) CheckpointContainer(ctx context.Context, options
|
||||
}
|
||||
|
||||
func (r *remoteRuntimeService) GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error {
|
||||
return nil
|
||||
containerEventsStreamingClient, err := r.runtimeClient.GetContainerEvents(context.Background(), &runtimeapi.GetEventsRequest{})
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "GetContainerEvents failed to get streaming client")
|
||||
return err
|
||||
}
|
||||
|
||||
for {
|
||||
resp, err := containerEventsStreamingClient.Recv()
|
||||
if err == io.EOF {
|
||||
klog.ErrorS(err, "container events stream is closed")
|
||||
return err
|
||||
}
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "failed to receive streaming container event")
|
||||
return err
|
||||
}
|
||||
if resp != nil {
|
||||
containerEventsCh <- resp
|
||||
klog.V(4).InfoS("container event received", "resp", resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user