@@ -31,6 +31,7 @@ import (
31
31
utilerrors "k8s.io/apimachinery/pkg/util/errors"
32
32
helpers "k8s.io/component-helpers/resource"
33
33
kubecm "k8s.io/kubernetes/pkg/kubelet/cm"
34
+ "k8s.io/kubernetes/pkg/kubelet/kuberuntime"
34
35
"k8s.io/kubernetes/test/e2e/framework"
35
36
imageutils "k8s.io/kubernetes/test/utils/image"
36
37
@@ -49,7 +50,7 @@ const (
49
50
Cgroupv2CPURequest string = "/sys/fs/cgroup/cpu.weight"
50
51
CPUPeriod string = "100000"
51
52
MinContainerRuntimeVersion string = "1.6.9"
52
- MinimumGracePeriodSeconds int64 = 2
53
+ MinRestartWaitPeriod int = 10
53
54
)
54
55
55
56
var (
@@ -169,7 +170,7 @@ func makeResizableContainer(tcInfo ResizableContainerInfo) v1.Container {
169
170
func MakePodWithResizableContainers (ns , name , timeStamp string , tcInfo []ResizableContainerInfo ) * v1.Pod {
170
171
testInitContainers , testContainers := separateContainers (tcInfo )
171
172
172
- var minGracePeriodSeconds int64 = MinimumGracePeriodSeconds
173
+ minGracePeriodSeconds := kuberuntime . MinimumGracePeriodInSeconds
173
174
pod := & v1.Pod {
174
175
ObjectMeta : metav1.ObjectMeta {
175
176
Name : name ,
@@ -354,7 +355,8 @@ func VerifyPodContainersCgroupValues(ctx context.Context, f *framework.Framework
354
355
}
355
356
errs = append (errs , VerifyCgroupValue (f , pod , ci .Name , cgroupCPULimit , expectedCPULimitString ))
356
357
errs = append (errs , VerifyCgroupValue (f , pod , ci .Name , cgroupCPURequest , strconv .FormatInt (expectedCPUShares , 10 )))
357
- //TODO(vinaykul,InPlacePodVerticalScaling): Verify oom_score_adj when runc adds support for updating it
358
+ // TODO(vinaykul,InPlacePodVerticalScaling): Verify oom_score_adj when runc adds support for updating it
359
+ // See https://github.com/opencontainers/runc/pull/4669
358
360
}
359
361
}
360
362
return utilerrors .NewAggregate (errs )
@@ -425,8 +427,12 @@ func WaitForPodResizeActuation(ctx context.Context, f *framework.Framework, podC
425
427
})),
426
428
)
427
429
428
- // Wait 2x termination grace period to catch any restarts - expected or not
429
- time .Sleep (time .Duration (* pod .Spec .TerminationGracePeriodSeconds * 2 ) * time .Second )
430
+ // Wait min(3 x termination grace period, MinRestartWaitPeriod) to catch any restarts - expected or not
431
+ containerRestartWaitPeriod := int (* pod .Spec .TerminationGracePeriodSeconds ) * 3
432
+ if containerRestartWaitPeriod < MinRestartWaitPeriod {
433
+ containerRestartWaitPeriod = MinRestartWaitPeriod
434
+ }
435
+ time .Sleep (time .Duration (containerRestartWaitPeriod ) * time .Second )
430
436
resizedPod , err := framework .GetObject (podClient .Get , pod .Name , metav1.GetOptions {})(ctx )
431
437
framework .ExpectNoError (err , "failed to get resized pod" )
432
438
return resizedPod
0 commit comments