Add fake runtimes and CRI changes for KEP-2371

Added new gRPC call 'ListPodSanboxMetrics' which would return additional
container stats currently supported by cAdvisor, but outside the scope
of /stats/summary api. Added new types to support metric exporting of
prometheus, including Metric and other subfields. Added fake runtime
changes associated with the CRI changes.
This commit is contained in:
Daniel Ye
2022-10-12 19:08:31 +00:00
committed by Peter Hunt
parent 435606b109
commit dcc7c2f660
7 changed files with 2626 additions and 404 deletions

View File

@@ -336,3 +336,23 @@ func (f *RemoteRuntime) CheckpointContainer(ctx context.Context, req *kubeapi.Ch
func (f *RemoteRuntime) GetContainerEvents(req *kubeapi.GetEventsRequest, ces kubeapi.RuntimeService_GetContainerEventsServer) error {
return nil
}
// ListMetricDescriptors gets the descriptors for the metrics that will be returned in ListPodSandboxMetrics.
func (f *RemoteRuntime) ListMetricDescriptors(ctx context.Context, req *kubeapi.ListMetricDescriptorsRequest) (*kubeapi.ListMetricDescriptorsResponse, error) {
descs, err := f.RuntimeService.ListMetricDescriptors(ctx)
if err != nil {
return nil, err
}
return &kubeapi.ListMetricDescriptorsResponse{Descriptors: descs}, nil
}
// ListPodSandboxMetrics retrieves the metrics for all pod sandboxes.
func (f *RemoteRuntime) ListPodSandboxMetrics(ctx context.Context, req *kubeapi.ListPodSandboxMetricsRequest) (*kubeapi.ListPodSandboxMetricsResponse, error) {
podMetrics, err := f.RuntimeService.ListPodSandboxMetrics(ctx)
if err != nil {
return nil, err
}
return &kubeapi.ListPodSandboxMetricsResponse{PodMetrics: podMetrics}, nil
}