Skip to content

Commit 1191ad8

Browse files
committed
Update to add details of how the API will be serviced for the new fields
Signed-off-by: Kevin Klues <[email protected]>
1 parent ccacf27 commit 1191ad8

File tree

1 file changed

+42
-5
lines changed
  • keps/sig-node/3695-pod-resources-for-dra

1 file changed

+42
-5
lines changed

keps/sig-node/3695-pod-resources-for-dra/README.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,20 @@ This API is read-only, which removes a large class of risks. The aspects that we
9494

9595
### Proposed API
9696

97-
98-
Our proposal is to extend the existing PodResources gRPC service of the Kubelet with a repeated DynamicResource field in the ContainerResources message. This new field will contain information about the DRA resource class, the DRA resource claim and a list of CDI Devices allocated by a DRA driver.
99-
Additionally, we propose adding a Get method to the existing gRPC service to allow querying specific pods for their allocated resources.
100-
101-
The extended interface is shown in proto below:
97+
Our proposal is to extend the existing PodResources gRPC service of the Kubelet
98+
with a repeated `DynamicResource` field in the ContainerResources message. This
99+
new field will contain information about the DRA resource class, the DRA
100+
resource claim, and a list of CDI Devices allocated by a DRA driver.
101+
Additionally, we propose adding a `Get()` method to the existing gRPC service
102+
to allow querying specific pods for their allocated resources.
103+
104+
**Note:** The new `Get()` call is a strict subset of the `List()` call (which
105+
returns the list of PodResources for *all* pods acrosss *all* namespaces in the
106+
cluster). That is, it allows one to specify a specific pod and namespace to
107+
retrieve PodResources from, rather than having to query all of them all at
108+
once.
109+
110+
The full PodResources API (including our proposed extensions) can be seen below:
102111
```protobuf
103112
// PodResourcesLister is a service provided by the kubelet that provides information about the
104113
// node resources consumed by pods and containers on the node
@@ -193,6 +202,34 @@ message GetPodResourcesResponse {
193202
}
194203
```
195204

205+
Under the hood, retrieval of the information needed to populate the new
206+
`DynamicResource` field will be pulled from an in-memory cache stored within the
207+
`DRAManager` of the kubelet. This is similar to how the fields for
208+
`ContainerDevices` (from the `DeviceManager`) and `cpu_ids` (from the
209+
`CPUManager`) are populated today.
210+
211+
The one difference being that the `DeviceManager` and `CPUManager` checkpoint
212+
the state necessary to fill their in-memory caches, so that it can be
213+
repopulated across a kubelet restart. We will need to add a similar
214+
checkpointing mechanism in the `DRAManager` so that it can repopulate its
215+
in-memory cache as well. This will ensure that the information needed by the
216+
PodResources API is available for all running containers without needing to call
217+
out to each DRA resource driver to retrieve this information on-demand. We will
218+
follow the same pattern used by the `DeviceManager` and `CPUManager` to
219+
implement this checkpointing mechanism.
220+
221+
**Note:** Checkpointing is possible in the `DRAManager` because the set of CDI
222+
devices allocated to a container cannot change across its lifetime (just as the
223+
set of traditional devices injected into a container by the `DeviceMmanager`
224+
cannot change across its lifetime). Moreover, the set of CDI devices that have
225+
been injected into a container are not tied to the "availability" of the DRA
226+
driver that injected them -- i.e. once a DRA driver allocates a set of CDI
227+
devices to a container, that container will have full access to those devices
228+
for its entire lifetime (even if the DRA driver that injected them temporarily
229+
goes offline). In this way, the in-memory cache maintained by the `DRAManager`
230+
will always have the most up-to-date information for all running containers (so
231+
long as checkpointing is added as described to repopulate it across kubelet
232+
restarts).
196233

197234
##### Unit tests
198235

0 commit comments

Comments
 (0)