Skip to content

Commit ba21e5d

Browse files
authored
fix: nil map issue (#277)
1 parent c882888 commit ba21e5d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/utils/compose.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ func AddTFDefaultClientConfBeforePatch(
243243
Value: constants.NGPUPathValue,
244244
})
245245

246+
if len(pod.Spec.Containers[injectContainerIndex].Resources.Limits) == 0 {
247+
pod.Spec.Containers[injectContainerIndex].Resources.Limits = v1.ResourceList{}
248+
}
246249
pod.Spec.Containers[injectContainerIndex].Resources.Limits[constants.SharedMemResName] = resource.MustParse("1")
247250

248251
// disable GPU limiter killer switch
@@ -571,6 +574,9 @@ func AddWorkerConfAfterTemplate(ctx context.Context, spec *v1.PodSpec, workerCon
571574
},
572575
})
573576

577+
if len(spec.Containers[0].Resources.Limits) == 0 {
578+
spec.Containers[0].Resources.Limits = v1.ResourceList{}
579+
}
574580
spec.Containers[0].Resources.Limits[constants.SharedMemResName] = resource.MustParse("1")
575581

576582
// Add volume from host for CUDA hot migration and snapshot

0 commit comments

Comments
 (0)