Skip to content

Commit 2097b1c

Browse files
committed
[clusteragent] Fix wrong computation of the init container resources
1 parent c193822 commit 2097b1c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/clusteragent/admission/mutate/autoinstrumentation/auto_instrumentation.go

+8
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,14 @@ func podSumRessourceRequirements(pod *corev1.Pod) corev1.ResourceRequirements {
348348
if reqSum.Cmp(existingReq) == 1 {
349349
ressourceRequirement.Requests[k] = reqSum
350350
}
351+
352+
// The requests may be greater than the limits if the limits are not always set.
353+
// This causes the deployment to fail.
354+
// In that case, we set the limits to the requests.
355+
requests := ressourceRequirement.Requests[k]
356+
if requests.Cmp(ressourceRequirement.Limits[k]) == 1 {
357+
ressourceRequirement.Limits[k] = requests
358+
}
351359
}
352360

353361
return ressourceRequirement

0 commit comments

Comments
 (0)