Skip to content

Commit d3b507d

Browse files
committed
Fix test
1 parent de45e0e commit d3b507d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/k8s/src/hooks/prepare-job.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,13 @@ export async function prepareJob(
8383
)
8484
})
8585
if (services.find(service => service.resources?.limits && service.resources.limits["google.com/tpu"])) {
86-
if (container?.resources?.limits && container.resources.limits["google.com/tpu"]) {
86+
if (container?.resources?.requests && container.resources.requests["google.com/tpu"]) {
8787
core.debug("removing tpu from resources")
88-
delete container.resources.limits["google.com/tpu"]
88+
delete container.resources.requests["google.com/tpu"]
8989
core.debug(`resources ${container.resources}`)
90+
if (container.resources.limits && container.resources.limits["google.com/tpu"]) {
91+
delete container.resources.limits["google.com/tpu"]
92+
}
9093
}
9194
}
9295
}
@@ -319,12 +322,6 @@ function getTpuRequest(container: JobContainerInfo, createOptions: string): numb
319322
core.debug(`no tpu override for ${container}`)
320323
return 0
321324
}
322-
if (!container.resources) {
323-
container.resources = {}
324-
}
325-
if (!container.resources.limits) {
326-
container.resources.limits = {}
327-
}
328325

329326
return Number(match[1])
330327
}
@@ -394,6 +391,9 @@ export function createContainerSpec(
394391
podContainer.resources = {
395392
limits: {
396393
"google.com/tpu": String(tpuRequest)
394+
},
395+
requests: {
396+
"google.com/tpu": String(tpuRequest)
397397
}
398398
}
399399
core.debug(`podcontainer is ${podContainer}`)

0 commit comments

Comments
 (0)