Skip to content

Commit b0e73ce

Browse files
authored
Merge pull request #50 from klueska/update-v1.31
Update to work with Kubernetes 1.31
2 parents 6e99295 + 27d9f67 commit b0e73ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+451
-2188
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
vendor/
33
[._]*.sw[a-p]
44

5-
./dra-example-controller
65
./dra-example-kubeletplugin

Makefile

+3-23
Original file line numberDiff line numberDiff line change
@@ -102,35 +102,15 @@ coverage: test
102102
cat $(COVERAGE_FILE) | grep -v "_mock.go" > $(COVERAGE_FILE).no-mocks
103103
go tool cover -func=$(COVERAGE_FILE).no-mocks
104104

105-
generate: generate-clientset
106-
107-
generate-clientset: generate-crds
108-
mkdir -p $(CURDIR)/pkg/$(VENDOR)/resource
109-
rm -rf $(CURDIR)/pkg/$(VENDOR)/resource/clientset
110-
client-gen \
111-
--go-header-file=$(CURDIR)/hack/boilerplate.go.txt \
112-
--clientset-name "versioned" \
113-
--build-tag "ignore_autogenerated" \
114-
--output-package "$(MODULE)/pkg/$(VENDOR)/resource/clientset" \
115-
--input-base "$(MODULE)/api/$(VENDOR)/resource" \
116-
--output-base "$(CURDIR)/pkg/tmp_clientset" \
117-
--input "$(shell echo $(APIS) | tr ' ' ',')" \
118-
--plural-exceptions "$(shell echo $(PLURAL_EXCEPTIONS) | tr ' ' ',')"
119-
mv $(CURDIR)/pkg/tmp_clientset/$(MODULE)/pkg/$(VENDOR)/resource/clientset \
120-
$(CURDIR)/pkg/$(VENDOR)/resource/clientset
121-
rm -rf $(CURDIR)/pkg/tmp_clientset
122-
123-
generate-crds: vendor
124-
rm -rf $(CURDIR)/deployments/helm/$(DRIVER_NAME)/crds
105+
generate: generate-deepcopy
106+
107+
generate-deepcopy: vendor
125108
for api in $(APIS); do \
126109
rm -f $(CURDIR)/api/$(VENDOR)/resource/$${api}/zz_generated.deepcopy.go; \
127110
controller-gen \
128111
object:headerFile=$(CURDIR)/hack/boilerplate.go.txt,year=$(shell date +"%Y") \
129112
paths=$(CURDIR)/api/$(VENDOR)/resource/$${api}/ \
130113
output:object:dir=$(CURDIR)/api/$(VENDOR)/resource/$${api}; \
131-
controller-gen crd:crdVersions=v1 \
132-
paths=$(CURDIR)/api/$(VENDOR)/resource/$${api}/ \
133-
output:crd:dir=$(CURDIR)/deployments/helm/$(DRIVER_NAME)/crds; \
134114
done
135115

136116
# Generate an image for containerized builds

README.md

+137-31
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,15 @@ From here we will build the image for the example resource driver:
4545

4646
And create a `kind` cluster to run it in:
4747
```bash
48-
./demo/create-cluster.sh
48+
KUBE_GIT_VERSION=v1.30.0 BUILD_KIND_IMAGE=true KIND_K8S_TAG=v1.31.0-rc.1 ./demo/create-cluster.sh
4949
```
5050

51+
**Note**: The environment variables in the command above allow us to build a
52+
local node image against Kubernetes v1.31.0-rc.1. Once `kind` releases a node
53+
image for v1.31 these extra environment variables will no longer be needed. If
54+
you only plan on running tests for Kubernetes 1.30 then you can just use the
55+
latest `kind` image for v1.30 and omit these extra environment variables.
56+
5157
Once the cluster has been created successfully, double check everything is
5258
coming up as expected:
5359
```console
@@ -79,7 +85,6 @@ Double check the driver components have come up successfully:
7985
```console
8086
$ kubectl get pod -n dra-example-driver
8187
NAME READY STATUS RESTARTS AGE
82-
dra-example-driver-controller-7555d488db-nbd52 1/1 Running 0 1m
8388
dra-example-driver-kubeletplugin-qwmbl 1/1 Running 0 1m
8489
```
8590

@@ -88,32 +93,133 @@ And show the initial state of available GPU devices on the worker node:
8893
$ kubectl get resourceslice -o yaml
8994
apiVersion: v1
9095
items:
91-
- apiVersion: resource.k8s.io/v1alpha2
92-
driverName: gpu.resource.example.com
96+
- apiVersion: resource.k8s.io/v1alpha3
9397
kind: ResourceSlice
9498
metadata:
95-
creationTimestamp: "2024-04-17T13:45:44Z"
96-
generateName: dra-example-driver-cluster-worker-gpu.resource.example.com-
97-
name: dra-example-driver-cluster-worker-gpu.resource.example.comxktph
99+
creationTimestamp: "2024-07-16T13:00:06Z"
100+
generateName: dra-example-driver-cluster-worker-gpu.example.com-
101+
generation: 1
102+
name: dra-example-driver-cluster-worker-gpu.example.com-xhsqf
98103
ownerReferences:
99104
- apiVersion: v1
100105
controller: true
101106
kind: Node
102107
name: dra-example-driver-cluster-worker
103-
uid: 4dc7c3b2-d99c-492b-8ede-37d435e56b2d
104-
resourceVersion: "1189"
105-
uid: 61c965b5-54a9-40ee-88a1-c52a814fa624
106-
namedResources:
107-
instances:
108-
- name: gpu-0159f35e-99ee-b2b5-74f1-9d18df3f22ac
109-
- name: gpu-657bd2e7-f5c2-a7f2-fbaa-0d1cdc32f81b
110-
- name: gpu-18db0e85-99e9-c746-8531-ffeb86328b39
111-
- name: gpu-93d37703-997c-c46f-a531-755e3e0dc2ac
112-
- name: gpu-ee3e4b55-fcda-44b8-0605-64b7a9967744
113-
- name: gpu-9ede7e32-5825-a11b-fa3d-bab6d47e0243
114-
- name: gpu-e7b42cb1-4fd8-91b2-bc77-352a0c1f5747
115-
- name: gpu-f11773a1-5bfb-e48b-3d98-1beb5baaf08e
116-
nodeName: dra-example-driver-cluster-worker
108+
uid: 8a18f216-bd77-426a-86b1-a989bdacc135
109+
resourceVersion: "854"
110+
uid: ea955e01-eaf0-45ed-8a36-1c56e4b8bced
111+
spec:
112+
driver: gpu.example.com
113+
nodeName: dra-example-driver-cluster-worker
114+
pool:
115+
generation: 0
116+
name: dra-example-driver-cluster-worker
117+
resourceSliceCount: 1
118+
devices:
119+
- basic:
120+
attributes:
121+
driverVersion:
122+
version: 1.0.0
123+
index:
124+
int: 0
125+
model:
126+
string: LATEST-GPU-MODEL
127+
uuid:
128+
string: gpu-18db0e85-99e9-c746-8531-ffeb86328b39
129+
capacity:
130+
memory: 80Gi
131+
name: gpu-18db0e85-99e9-c746-8531-ffeb86328b39
132+
- basic:
133+
attributes:
134+
driverVersion:
135+
version: 1.0.0
136+
index:
137+
int: 1
138+
model:
139+
string: LATEST-GPU-MODEL
140+
uuid:
141+
string: gpu-93d37703-997c-c46f-a531-755e3e0dc2ac
142+
capacity:
143+
memory: 80Gi
144+
name: gpu-93d37703-997c-c46f-a531-755e3e0dc2ac
145+
- basic:
146+
attributes:
147+
driverVersion:
148+
version: 1.0.0
149+
index:
150+
int: 2
151+
model:
152+
string: LATEST-GPU-MODEL
153+
uuid:
154+
string: gpu-ee3e4b55-fcda-44b8-0605-64b7a9967744
155+
capacity:
156+
memory: 80Gi
157+
name: gpu-ee3e4b55-fcda-44b8-0605-64b7a9967744
158+
- basic:
159+
attributes:
160+
driverVersion:
161+
version: 1.0.0
162+
index:
163+
int: 3
164+
model:
165+
string: LATEST-GPU-MODEL
166+
uuid:
167+
string: gpu-9ede7e32-5825-a11b-fa3d-bab6d47e0243
168+
capacity:
169+
memory: 80Gi
170+
name: gpu-9ede7e32-5825-a11b-fa3d-bab6d47e0243
171+
- basic:
172+
attributes:
173+
driverVersion:
174+
version: 1.0.0
175+
index:
176+
int: 4
177+
model:
178+
string: LATEST-GPU-MODEL
179+
uuid:
180+
string: gpu-e7b42cb1-4fd8-91b2-bc77-352a0c1f5747
181+
capacity:
182+
memory: 80Gi
183+
name: gpu-e7b42cb1-4fd8-91b2-bc77-352a0c1f5747
184+
- basic:
185+
attributes:
186+
driverVersion:
187+
version: 1.0.0
188+
index:
189+
int: 5
190+
model:
191+
string: LATEST-GPU-MODEL
192+
uuid:
193+
string: gpu-f11773a1-5bfb-e48b-3d98-1beb5baaf08e
194+
capacity:
195+
memory: 80Gi
196+
name: gpu-f11773a1-5bfb-e48b-3d98-1beb5baaf08e
197+
- basic:
198+
attributes:
199+
driverVersion:
200+
version: 1.0.0
201+
index:
202+
int: 6
203+
model:
204+
string: LATEST-GPU-MODEL
205+
uuid:
206+
string: gpu-0159f35e-99ee-b2b5-74f1-9d18df3f22ac
207+
capacity:
208+
memory: 80Gi
209+
name: gpu-0159f35e-99ee-b2b5-74f1-9d18df3f22ac
210+
- basic:
211+
attributes:
212+
driverVersion:
213+
version: 1.0.0
214+
index:
215+
int: 7
216+
model:
217+
string: LATEST-GPU-MODEL
218+
uuid:
219+
string: gpu-657bd2e7-f5c2-a7f2-fbaa-0d1cdc32f81b
220+
capacity:
221+
memory: 80Gi
222+
name: gpu-657bd2e7-f5c2-a7f2-fbaa-0d1cdc32f81b
117223
kind: List
118224
metadata:
119225
resourceVersion: ""
@@ -165,28 +271,28 @@ This should produce output similar to the following:
165271
```bash
166272
gpu-test1:
167273
pod0 ctr0:
168-
declare -x GPU_DEVICE_0="GPU-657bd2e7-f5c2-a7f2-fbaa-0d1cdc32f81b"
274+
declare -x GPU_DEVICE_0="gpu-e7b42cb1-4fd8-91b2-bc77-352a0c1f5747"
169275
pod1 ctr0:
170-
declare -x GPU_DEVICE_0="GPU-ee3e4b55-fcda-44b8-0605-64b7a9967744"
276+
declare -x GPU_DEVICE_0="gpu-f11773a1-5bfb-e48b-3d98-1beb5baaf08e"
171277

172278
gpu-test2:
173279
pod0 ctr0:
174-
declare -x GPU_DEVICE_0="GPU-9ede7e32-5825-a11b-fa3d-bab6d47e0243"
280+
declare -x GPU_DEVICE_0="gpu-0159f35e-99ee-b2b5-74f1-9d18df3f22ac"
175281
pod0 ctr1:
176-
declare -x GPU_DEVICE_0="GPU-9ede7e32-5825-a11b-fa3d-bab6d47e0243"
282+
declare -x GPU_DEVICE_0="gpu-0159f35e-99ee-b2b5-74f1-9d18df3f22ac"
177283

178284
gpu-test3:
179285
pod0 ctr0:
180-
declare -x GPU_DEVICE_0="GPU-93d37703-997c-c46f-a531-755e3e0dc2ac"
286+
declare -x GPU_DEVICE_0="gpu-657bd2e7-f5c2-a7f2-fbaa-0d1cdc32f81b"
181287
pod1 ctr0:
182-
declare -x GPU_DEVICE_0="GPU-93d37703-997c-c46f-a531-755e3e0dc2ac"
288+
declare -x GPU_DEVICE_0="gpu-657bd2e7-f5c2-a7f2-fbaa-0d1cdc32f81b"
183289

184290
gpu-test4:
185291
pod0 ctr0:
186-
declare -x GPU_DEVICE_0="GPU-18db0e85-99e9-c746-8531-ffeb86328b39"
187-
declare -x GPU_DEVICE_1="GPU-e7b42cb1-4fd8-91b2-bc77-352a0c1f5747"
188-
declare -x GPU_DEVICE_2="GPU-f11773a1-5bfb-e48b-3d98-1beb5baaf08e"
189-
declare -x GPU_DEVICE_3="GPU-0159f35e-99ee-b2b5-74f1-9d18df3f22ac"
292+
declare -x GPU_DEVICE_0="gpu-18db0e85-99e9-c746-8531-ffeb86328b39"
293+
declare -x GPU_DEVICE_1="gpu-93d37703-997c-c46f-a531-755e3e0dc2ac"
294+
declare -x GPU_DEVICE_2="gpu-ee3e4b55-fcda-44b8-0605-64b7a9967744"
295+
declare -x GPU_DEVICE_3="gpu-9ede7e32-5825-a11b-fa3d-bab6d47e0243"
190296
```
191297

192298
In this example resource driver, no "actual" GPUs are made available to any

0 commit comments

Comments
 (0)