Skip to content

Commit 20a288c

Browse files
committed
fix: bump deps, inject-container convert from limits
1 parent aa19def commit 20a288c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/webhook/v1/tf_parser.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func parseAutoScalingAnnotations(pod *corev1.Pod, workloadProfile *tfv1.Workload
182182

183183
func parseGPUResourcesAnnotations(pod *corev1.Pod, workloadProfile *tfv1.WorkloadProfile) error {
184184
// extract any containers has GPU count limits and set to annotation
185-
isMigratedFromContainerLimits := false
185+
migratedContainerLimits := []string{}
186186
gpuCount, hasValue := pod.Annotations[constants.GpuCountAnnotation]
187187
if hasValue {
188188
val, err := strconv.ParseInt(gpuCount, 10, 32)
@@ -215,8 +215,10 @@ func parseGPUResourcesAnnotations(pod *corev1.Pod, workloadProfile *tfv1.Workloa
215215
if tflopsLimit, hasValue := parseResourceQuantity(pod, constants.TFLOPSLimitAnnotation); hasValue {
216216
workloadProfile.Spec.Resources.Limits.Tflops = tflopsLimit
217217
// clean compute percent limit when tflops limit is set in annotation
218-
if isMigratedFromContainerLimits {
218+
if len(migratedContainerLimits) > 0 {
219219
workloadProfile.Spec.Resources.Limits.ComputePercent = resource.Quantity{}
220+
// convert limits containers to annotation for inject container
221+
pod.Annotations[constants.InjectContainerAnnotation] = strings.Join(migratedContainerLimits, ",")
220222
}
221223
}
222224
if vramLimit, hasValue := parseResourceQuantity(pod, constants.VRAMLimitAnnotation); hasValue {

0 commit comments

Comments
 (0)