@@ -244,43 +244,40 @@ Next, deploy four example apps that demonstrate how `ResourceClaim`s,
244244` ResourceClaimTemplate ` s, and custom ` GpuConfig ` objects can be used to
245245select and configure resources in various ways:
246246``` bash
247- kubectl apply --filename=demo/gpu-test{1,2,3,4,5}.yaml
247+ kubectl apply --filename=demo/basic-resourceclaimtemplate.yaml \
248+ --filename=demo/basic-multiple-requests.yaml \
249+ --filename=demo/basic-shared-claim-across-containers.yaml \
250+ --filename=demo/basic-shared-claim-across-pods.yaml \
251+ --filename=demo/basic-resourceclaim-opaque-config.yaml
248252```
249253
250254And verify that they are coming up successfully:
251255``` console
252256$ kubectl get pod -A
253- NAMESPACE NAME READY STATUS RESTARTS AGE
257+ NAMESPACE NAME READY STATUS RESTARTS AGE
254258...
255- gpu-test1 pod0 0/1 Pending 0 2s
256- gpu-test1 pod1 0/1 Pending 0 2s
257- gpu-test2 pod0 0/2 Pending 0 2s
258- gpu-test3 pod0 0/1 ContainerCreating 0 2s
259- gpu-test3 pod1 0/1 ContainerCreating 0 2s
260- gpu-test4 pod0 0/1 Pending 0 2s
261- gpu-test5 pod0 0/4 Pending 0 2s
259+ basic-resourceclaimtemplate pod0 0/1 Pending 0 2s
260+ basic-resourceclaimtemplate pod1 0/1 Pending 0 2s
261+ basic-multiple-requests pod0 0/2 Pending 0 2s
262+ basic-shared-claim-across-containers pod0 0/1 ContainerCreating 0 2s
263+ basic-shared-claim-across-containers pod1 0/1 ContainerCreating 0 2s
264+ basic-shared-claim-across-pods pod0 0/1 Pending 0 2s
265+ basic-resourceclaim-opaque-config pod0 0/4 Pending 0 2s
262266...
263267```
264268
265- Use your favorite editor to look through each of the ` gpu-test{1,2,3,4,5}.yaml `
266- files and see what they are doing. The semantics of each match the figure
267- below:
268-
269- ![ Demo Apps Figure] ( demo/demo-apps.png?raw=true " Semantics of the applications requesting resources from the example DRA resource driver. ")
269+ Use your favorite editor to look through each of the ` basic-*.yaml `
270+ files and see what they are doing.
270271
271272Then dump the logs of each app to verify that GPUs were allocated to them
272273according to these semantics:
273274``` bash
274- for example in $( seq 1 5 ) ; do \
275- echo " gpu-test ${example } :"
276- for pod in $( kubectl get pod -n gpu-test ${example } --output=jsonpath=' {.items[*].metadata.name}' ) ; do \
277- for ctr in $( kubectl get pod -n gpu-test ${example } ${pod} -o jsonpath=' {.spec.containers[*].name}' ) ; do \
275+ for ns in basic-resourceclaimtemplate basic-multiple-requests basic-shared-claim-across-containers basic-shared-claim-across-pods basic-resourceclaim-opaque-config ; do \
276+ echo " ${ns } :"
277+ for pod in $( kubectl get pod -n ${ns } --output=jsonpath=' {.items[*].metadata.name}' ) ; do \
278+ for ctr in $( kubectl get pod -n ${ns } ${pod} -o jsonpath=' {.spec.containers[*].name}' ) ; do \
278279 echo " ${pod} ${ctr} :"
279- if [ " ${example} " -lt 3 ]; then
280- kubectl logs -n gpu-test${example} ${pod} -c ${ctr} | grep -E " GPU_DEVICE_[0-9]+=" | grep -v " RESOURCE_CLAIM"
281- else
282- kubectl logs -n gpu-test${example} ${pod} -c ${ctr} | grep -E " GPU_DEVICE_[0-9]+" | grep -v " RESOURCE_CLAIM"
283- fi
280+ kubectl logs -n ${ns} ${pod} -c ${ctr} | grep -E " GPU_DEVICE_[0-9]+" | grep -v " RESOURCE_CLAIM"
284281 done
285282 done
286283 echo " "
@@ -289,18 +286,18 @@ done
289286
290287This should produce output similar to the following:
291288``` bash
292- gpu-test1 :
289+ basic-resourceclaimtemplate :
293290pod0 ctr0:
294291declare -x GPU_DEVICE_6=" gpu-6"
295292pod1 ctr0:
296293declare -x GPU_DEVICE_7=" gpu-7"
297294
298- gpu-test2 :
295+ basic-multiple-requests :
299296pod0 ctr0:
300297declare -x GPU_DEVICE_0=" gpu-0"
301298declare -x GPU_DEVICE_1=" gpu-1"
302299
303- gpu-test3 :
300+ basic-shared-claim-across-containers :
304301pod0 ctr0:
305302declare -x GPU_DEVICE_2=" gpu-2"
306303declare -x GPU_DEVICE_2_SHARING_STRATEGY=" TimeSlicing"
@@ -310,7 +307,7 @@ declare -x GPU_DEVICE_2="gpu-2"
310307declare -x GPU_DEVICE_2_SHARING_STRATEGY=" TimeSlicing"
311308declare -x GPU_DEVICE_2_TIMESLICE_INTERVAL=" Default"
312309
313- gpu-test4 :
310+ basic-shared-claim-across-pods :
314311pod0 ctr0:
315312declare -x GPU_DEVICE_3=" gpu-3"
316313declare -x GPU_DEVICE_3_SHARING_STRATEGY=" TimeSlicing"
@@ -320,7 +317,7 @@ declare -x GPU_DEVICE_3="gpu-3"
320317declare -x GPU_DEVICE_3_SHARING_STRATEGY=" TimeSlicing"
321318declare -x GPU_DEVICE_3_TIMESLICE_INTERVAL=" Default"
322319
323- gpu-test5 :
320+ basic-resourceclaim-opaque-config :
324321pod0 ts-ctr0:
325322declare -x GPU_DEVICE_4=" gpu-4"
326323declare -x GPU_DEVICE_4_SHARING_STRATEGY=" TimeSlicing"
@@ -353,14 +350,14 @@ This example driver includes support for the [DRA AdminAccess feature](https://k
353350
354351#### Usage Example
355352
356- See ` demo/gpu-test7 .yaml ` for a complete example. Key points:
353+ See ` demo/admin-access .yaml ` for a complete example. Key points:
357354
3583551 . ** Namespace** : Must have the ` resource.kubernetes.io/admin-access ` label set to create ResourceClaimTemplate and ResourceClaim with ` adminAccess: true ` for Kubernetes v1.34+.
359356``` yaml
360357apiVersion : v1
361358kind : Namespace
362359metadata :
363- name : gpu-test7
360+ name : admin-access
364361 labels :
365362 resource.kubernetes.io/admin-access : " true"
366363` ` `
@@ -399,22 +396,27 @@ This demonstration shows the end-to-end flow of the DRA AdminAccess feature. In
399396Once you have verified everything is running correctly, delete all of the
400397example apps :
401398` ` ` bash
402- kubectl delete --wait=false --filename=demo/gpu-test{1,2,3,4,5,7}.yaml
399+ kubectl delete --wait=false --filename=demo/basic-resourceclaimtemplate.yaml \
400+ --filename=demo/basic-multiple-requests.yaml \
401+ --filename=demo/basic-shared-claim-across-containers.yaml \
402+ --filename=demo/basic-shared-claim-across-pods.yaml \
403+ --filename=demo/basic-resourceclaim-opaque-config.yaml \
404+ --filename=demo/admin-access.yaml
403405` ` `
404406
405407And wait for them to terminate :
406408` ` ` console
407409$ kubectl get pod -A
408- NAMESPACE NAME READY STATUS RESTARTS AGE
410+ NAMESPACE NAME READY STATUS RESTARTS AGE
409411...
410- gpu-test1 pod0 1/1 Terminating 0 31m
411- gpu-test1 pod1 1/1 Terminating 0 31m
412- gpu-test2 pod0 2/2 Terminating 0 31m
413- gpu-test3 pod0 1/1 Terminating 0 31m
414- gpu-test3 pod1 1/1 Terminating 0 31m
415- gpu-test4 pod0 1/1 Terminating 0 31m
416- gpu-test5 pod0 4/4 Terminating 0 31m
417- gpu-test7 pod0 1/1 Terminating 0 31m
412+ basic-resourceclaimtemplate pod0 1/1 Terminating 0 31m
413+ basic-resourceclaimtemplate pod1 1/1 Terminating 0 31m
414+ basic-multiple-requests pod0 2/2 Terminating 0 31m
415+ basic-shared-claim-across-containers pod0 1/1 Terminating 0 31m
416+ basic-shared-claim-across-containers pod1 1/1 Terminating 0 31m
417+ basic-shared-claim-across-pods pod0 1/1 Terminating 0 31m
418+ basic-resourceclaim-opaque-config pod0 4/4 Terminating 0 31m
419+ admin-access pod0 1/1 Terminating 0 31m
418420...
419421` ` `
420422
0 commit comments