Update CRI API to support Evented PLEG

Signed-off-by: Harshal Patil <harpatil@redhat.com>
This commit is contained in:
Harshal Patil 2022-07-25 11:41:47 +05:30
parent 7bcd739851
commit 668b2440c5
7 changed files with 981 additions and 366 deletions

View File

@ -332,3 +332,7 @@ func (f *RemoteRuntime) CheckpointContainer(ctx context.Context, req *kubeapi.Ch
return &kubeapi.CheckpointContainerResponse{}, nil return &kubeapi.CheckpointContainerResponse{}, nil
} }
func (f *RemoteRuntime) GetContainerEvents(req *kubeapi.GetEventsRequest, ces kubeapi.RuntimeService_GetContainerEventsServer) error {
return nil
}

View File

@ -1208,3 +1208,7 @@ func (r *remoteRuntimeService) CheckpointContainer(options *runtimeapi.Checkpoin
return nil return nil
} }
func (r *remoteRuntimeService) GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error {
return nil
}

View File

@ -333,3 +333,12 @@ func (in instrumentedRuntimeService) CheckpointContainer(options *runtimeapi.Che
recordError(operation, err) recordError(operation, err)
return err return err
} }
func (in instrumentedRuntimeService) GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error {
const operation = "get_container_events"
defer recordOperation(operation, time.Now())
err := in.service.GetContainerEvents(containerEventsCh)
recordError(operation, err)
return err
}

File diff suppressed because it is too large Load Diff

View File

@ -117,6 +117,10 @@ service RuntimeService {
// CheckpointContainer checkpoints a container // CheckpointContainer checkpoints a container
rpc CheckpointContainer(CheckpointContainerRequest) returns (CheckpointContainerResponse) {} rpc CheckpointContainer(CheckpointContainerRequest) returns (CheckpointContainerResponse) {}
// GetContainerEvents gets container events from the CRI runtime
rpc GetContainerEvents(GetEventsRequest) returns (stream ContainerEventResponse) {}
} }
// ImageService defines the public APIs for managing images. // ImageService defines the public APIs for managing images.
@ -1559,3 +1563,33 @@ message CheckpointContainerRequest {
} }
message CheckpointContainerResponse {} message CheckpointContainerResponse {}
message GetEventsRequest {}
message ContainerEventResponse {
// ID of the container
string container_id = 1;
// Type of the container event
ContainerEventType container_event_type = 2;
// Creation timestamp of this event
int64 created_at = 3;
// ID of the sandbox container
PodSandboxMetadata pod_sandbox_metadata = 4;
}
enum ContainerEventType {
// Container created
CONTAINER_CREATED_EVENT = 0;
// Container started
CONTAINER_STARTED_EVENT = 1;
// Container stopped
CONTAINER_STOPPED_EVENT = 2;
// Container deleted
CONTAINER_DELETED_EVENT = 3;
}

View File

@ -58,6 +58,8 @@ type ContainerManager interface {
ReopenContainerLog(ContainerID string) error ReopenContainerLog(ContainerID string) error
// CheckpointContainer checkpoints a container // CheckpointContainer checkpoints a container
CheckpointContainer(options *runtimeapi.CheckpointContainerRequest) error CheckpointContainer(options *runtimeapi.CheckpointContainerRequest) error
// GetContainerEvents gets container events from the CRI runtime
GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error
} }
// PodSandboxManager contains methods for operating on PodSandboxes. The methods // PodSandboxManager contains methods for operating on PodSandboxes. The methods

View File

@ -708,3 +708,7 @@ func (r *FakeRuntimeService) CheckpointContainer(options *runtimeapi.CheckpointC
return nil return nil
} }
func (f *FakeRuntimeService) GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error {
return nil
}