@@ -189,10 +189,87 @@ The kubelet provides a gRPC service to enable discovery of in-use devices, and t
189189for these devices:
190190
191191``` gRPC
192- // PodResourcesLister is a service provided by the kubelet that provides information about the
192+ // PodResources is a service provided by the kubelet that provides information about the
193193// node resources consumed by pods and containers on the node
194- service PodResourcesLister {
194+ service PodResources {
195195 rpc List(ListPodResourcesRequest) returns (ListPodResourcesResponse) {}
196+ rpc GetAllocatableResources(AllocatableResourcesRequest) returns (AllocatableResourcesResponse) {}
197+ rpc Watch(WatchPodResourcesRequest) returns (stream WatchPodResourcesResponse) {}
198+ }
199+ ```
200+
201+ List endpoint provides information on resources of running pods with details such as
202+ id of exclusively allocated CPUs, device id as it was reported by device plugins and id of
203+ NUMA node where these devices are allocated.
204+
205+ ``` gRPC
206+ // ListPodResourcesResponse is the response returned by List function
207+ message ListPodResourcesResponse {
208+ repeated PodResources pod_resources = 1;
209+ }
210+
211+ // PodResources contains information about the node resources assigned to a pod
212+ message PodResources {
213+ string name = 1;
214+ string namespace = 2;
215+ repeated ContainerResources containers = 3;
216+ }
217+
218+ // ContainerResources contains information about the resources assigned to a container
219+ message ContainerResources {
220+ string name = 1;
221+ repeated ContainerDevices devices = 2;
222+ repeated int64 cpu_ids = 3;
223+ }
224+
225+ // Topology describes hardware topology of the resource
226+ message TopologyInfo {
227+ repeated NUMANode nodes = 1;
228+ }
229+
230+ // NUMA representation of NUMA node
231+ message NUMANode {
232+ int64 ID = 1;
233+ }
234+
235+ // ContainerDevices contains information about the devices assigned to a container
236+ message ContainerDevices {
237+ string resource_name = 1;
238+ repeated string device_ids = 2;
239+ TopologyInfo topology = 3;
240+ }
241+ ```
242+
243+ GetAllocatableResources provides information on resources initially available on the worker node.
244+ It provides more information than kubelet exports to APIServer.
245+
246+ ``` gRPC
247+ // AvailableResourcesResponses contains information about all the devices known by the kubelet
248+ message AllocatableResourcesResponse {
249+ repeated ContainerDevices devices = 1;
250+ repeated int64 cpu_ids = 2;
251+ }
252+
253+ ```
254+
255+ Watch intends to quickly obtain information on a newly launched pod, the information obtained is the same
256+ as obtained by List. By using Watch endpoint Monitoring agents do not need to call List periodically anymore.
257+
258+ ``` gRPC
259+
260+ // WatchPodResourcesRequest is the request made to the Watch PodResourcesLister service
261+ message WatchPodResourcesRequest {}
262+
263+ enum WatchPodAction {
264+ ADDED = 0;
265+ DELETED = 1;
266+ }
267+
268+ // WatchPodResourcesResponse is the response returned by Watch function
269+ message WatchPodResourcesResponse {
270+ WatchPodAction action = 1;
271+ string uid = 2;
272+ repeated PodResources pod_resources = 3;
196273}
197274```
198275
0 commit comments