@@ -138,13 +138,16 @@ def build_ray_cluster(cluster: "codeflare_sdk.ray.cluster.Cluster"):
138
138
"num-gpus" : str (head_gpu_count ),
139
139
"resources" : head_resources ,
140
140
},
141
- "template" : {
142
- "spec" : get_pod_spec (
141
+ "template" : V1PodTemplateSpec (
142
+ metadata = V1ObjectMeta (cluster .config .annotations )
143
+ if cluster .config .annotations
144
+ else None ,
145
+ spec = get_pod_spec (
143
146
cluster ,
144
147
[get_head_container_spec (cluster )],
145
148
cluster .config .head_tolerations ,
146
- )
147
- } ,
149
+ ),
150
+ ) ,
148
151
},
149
152
"workerGroupSpecs" : [
150
153
{
@@ -158,11 +161,14 @@ def build_ray_cluster(cluster: "codeflare_sdk.ray.cluster.Cluster"):
158
161
"resources" : worker_resources ,
159
162
},
160
163
"template" : V1PodTemplateSpec (
164
+ metadata = V1ObjectMeta (cluster .config .annotations )
165
+ if cluster .config .annotations
166
+ else None ,
161
167
spec = get_pod_spec (
162
168
cluster ,
163
169
[get_worker_container_spec (cluster )],
164
170
cluster .config .worker_tolerations ,
165
- )
171
+ ),
166
172
),
167
173
}
168
174
],
@@ -215,7 +221,7 @@ def build_ray_cluster(cluster: "codeflare_sdk.ray.cluster.Cluster"):
215
221
# Metadata related functions
216
222
def get_metadata (cluster : "codeflare_sdk.ray.cluster.Cluster" ):
217
223
"""
218
- The get_metadata() function builds and returns a V1ObjectMeta Object using cluster configurtation parameters
224
+ The get_metadata() function builds and returns a V1ObjectMeta Object using cluster configuration parameters
219
225
"""
220
226
object_meta = V1ObjectMeta (
221
227
name = cluster .config .name ,
@@ -227,6 +233,7 @@ def get_metadata(cluster: "codeflare_sdk.ray.cluster.Cluster"):
227
233
annotations = with_nb_annotations (cluster .config .annotations )
228
234
if annotations != {}:
229
235
object_meta .annotations = annotations # As annotations are not a guarantee they are appended to the metadata after creation.
236
+
230
237
return object_meta
231
238
232
239
0 commit comments