mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 02:06:23 +00:00
Merge pull request #137866 from ndixita/ippr-flaky-test
[InPlacePodLevelResourcesVerticalScaling] Ippr flaky test
This commit is contained in:
@@ -375,13 +375,14 @@ func WaitForPodResizeActuation(ctx context.Context, f *framework.Framework, podC
|
||||
return "resize is infeasible"
|
||||
}, nil
|
||||
}
|
||||
// TODO: Replace this check with a combination of checking the status.observedGeneration
|
||||
// and the resize status when available.
|
||||
if resourceErrs := VerifyPodStatusResources(pod, expectedContainers); resourceErrs != nil {
|
||||
|
||||
if pod.Status.ObservedGeneration < pod.Generation {
|
||||
return func() string {
|
||||
return fmt.Sprintf("container status resources don't match expected: %v", formatErrors(resourceErrs))
|
||||
return fmt.Sprintf("waiting for observedGeneration (%d) to catch up to generation (%d)",
|
||||
pod.Status.ObservedGeneration, pod.Generation)
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Wait for kubelet to clear the resize status conditions.
|
||||
for _, c := range pod.Status.Conditions {
|
||||
if c.Type == v1.PodResizePending || c.Type == v1.PodResizeInProgress {
|
||||
@@ -390,6 +391,7 @@ func WaitForPodResizeActuation(ctx context.Context, f *framework.Framework, podC
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the pod to be ready.
|
||||
if !podutils.IsPodReady(pod) {
|
||||
return func() string { return "pod is not ready" }, nil
|
||||
|
||||
@@ -71,17 +71,20 @@ func doGuaranteedPodLevelResizeTests(f *framework.Framework) {
|
||||
expectedContainers := makeGuaranteedContainers(1, cpuPolicy, memPolicy, true, true, desiredCtrCPU, desiredCtrMem)
|
||||
for i, c := range expectedContainers {
|
||||
// If the pod has init containers, but we are not resizing them, keep the original resources.
|
||||
if c.InitCtr && !resizeInitCtrs {
|
||||
podLevelOnly := (desiredCtrCPU == "" && desiredPodCPU != originalCPU) || (desiredCtrMem == "" && desiredPodMem != originalMem)
|
||||
|
||||
if c.InitCtr && !resizeInitCtrs && !podLevelOnly {
|
||||
c.Resources = originalContainers[i].Resources
|
||||
expectedContainers[i] = c
|
||||
continue
|
||||
}
|
||||
// For containers where the resize policy is "restart", we expect a restart.
|
||||
expectRestart := int32(0)
|
||||
if cpuPolicy == v1.RestartContainer && desiredCtrCPU != originalCtrCPU {
|
||||
|
||||
if cpuPolicy == v1.RestartContainer && (desiredCtrCPU != originalCtrCPU || (desiredCtrCPU == "" && desiredPodCPU != originalCPU)) {
|
||||
expectRestart = 1
|
||||
}
|
||||
if memPolicy == v1.RestartContainer && desiredCtrMem != originalCtrMem {
|
||||
if memPolicy == v1.RestartContainer && (desiredCtrMem != originalCtrMem || (desiredCtrMem == "" && desiredPodMem != originalMem)) {
|
||||
expectRestart = 1
|
||||
}
|
||||
c.RestartCount = expectRestart
|
||||
|
||||
Reference in New Issue
Block a user