Skip to content

Commit daab4b8

Browse files
Add numaid and cpus into PodResources interface
This change necessary for resource with topology exporting daemon, which used in topology aware scheduling. Information about CPU is keeping in cpu_ids, since it's enough to represent both quantity and numaid. NUMAid can be obtained from cadvisor MachineInfo, since id in cpus_ids is a thread_id. This API doesn't provide cpu fraction, since it could be obtainded from Pod's request/limits and in case of non-integer CPU quantity and non-guaranteed QoS cpu assigned is not exclusive and NUMA id is not interesting. Signed-off-by: Alexey Perevalov <[email protected]>
1 parent 3b6b4eb commit daab4b8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

keps/sig-node/compute-device-assignment.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ creation-date: "2018-07-19"
1616
last-updated: "2019-04-30"
1717
status: implementable
1818
---
19-
# Kubelet endpoint for device assignment observation details
19+
# Kubelet endpoint for device assignment observation details
2020

2121
## Table of Contents
2222

@@ -57,10 +57,15 @@ In this document we will discuss the motivation and code changes required for in
5757

5858
![device monitoring architecture](https://user-images.githubusercontent.com/3262098/43926483-44331496-9bdf-11e8-82a0-14b47583b103.png)
5959

60+
### Device aware CNI plugin
61+
After this interface has been introduced it was used by CNI plugins like [kuryr-kubernetes](https://review.opendev.org/#/c/651580/) in couple with [intel-sriov-device-plugin](https://github.com/intel/sriov-network-device-plugin) to correctly define which devices were assigned to the pod.
62+
63+
### Topology aware scheduling
64+
This interface can be used to collect allocated resources with information about the NUMA topology of the worker node. This information can then be used in NUMA aware scheduling.
6065

6166
## Changes
6267

63-
Add a v1alpha1 Kubelet GRPC service, at `/var/lib/kubelet/pod-resources/kubelet.sock`, which returns information about the kubelet's assignment of devices to containers. It obtains this information from the internal state of the kubelet's Device Manager. The GRPC Service returns a single PodResourcesResponse, which is shown in proto below:
68+
Add a v1alpha1 Kubelet GRPC service, at `/var/lib/kubelet/pod-resources/kubelet.sock`, which returns information about the kubelet's assignment of devices and cpus to containers with NUMA id. It obtains this information from the internal state of the kubelet's Device Manager and CPU Manager respectively. The GRPC Service returns a single PodResourcesResponse, which is shown in proto below:
6469
```protobuf
6570
// PodResources is a service provided by the kubelet that provides information about the
6671
// node resources consumed by pods and containers on the node
@@ -87,12 +92,14 @@ message PodResources {
8792
message ContainerResources {
8893
string name = 1;
8994
repeated ContainerDevices devices = 2;
95+
repeated uint32 cpu_ids = 3;
9096
}
9197
9298
// ContainerDevices contains information about the devices assigned to a container
9399
message ContainerDevices {
94100
string resource_name = 1;
95101
repeated string device_ids = 2;
102+
uint32 numaid = 3;
96103
}
97104
```
98105

@@ -113,7 +120,7 @@ message ContainerDevices {
113120
* Notes:
114121
* Does not include any reference to resource names. Monitoring agentes must identify devices by the device or environment variables passed to the pod or container.
115122

116-
### Add a field to Pod Status.
123+
### Add a field to Pod Status.
117124
* Pros:
118125
* Allows for observation of container to device bindings local to the node through the `/pods` endpoint
119126
* Cons:
@@ -148,7 +155,7 @@ type Container struct {
148155
}
149156
```
150157
* During Kubelet pod admission, if `ComputeDevices` is found non-empty, specified devices will be allocated otherwise behaviour will remain same as it is today.
151-
* Before starting the pod, the kubelet writes the assigned `ComputeDevices` back to the pod spec.
158+
* Before starting the pod, the kubelet writes the assigned `ComputeDevices` back to the pod spec.
152159
* Note: Writing to the Api Server and waiting to observe the updated pod spec in the kubelet's pod watch may add significant latency to pod startup.
153160
* Allows devices to potentially be assigned by a custom scheduler.
154161
* Serves as a permanent record of device assignments for the kubelet, and eliminates the need for the kubelet to maintain this state locally.

0 commit comments

Comments
 (0)