Skip to content

Commit 4965a7a

Browse files
authored
KEP-4603: Refactor various hardcoded backoffs into separate constants (kubernetes#128369)
* Refactor various hardcoded backoffs into separate constants Signed-off-by: Laura Lorenz <[email protected]> * Fix comment formatting Signed-off-by: Laura Lorenz <[email protected]> --------- Signed-off-by: Laura Lorenz <[email protected]>
1 parent e5a31e8 commit 4965a7a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

pkg/kubelet/kubelet.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,12 @@ const (
144144
// DefaultContainerLogsDir is the location of container logs.
145145
DefaultContainerLogsDir = "/var/log/containers"
146146

147-
// MaxContainerBackOff is the max backoff period, exported for the e2e test
147+
// MaxContainerBackOff is the max backoff period for container restarts, exported for the e2e test
148148
MaxContainerBackOff = 300 * time.Second
149149

150+
// MaxImageBackOff is the max backoff period for image pulls, exported for the e2e test
151+
MaxImageBackOff = 300 * time.Second
152+
150153
// Period for performing global cleanup tasks.
151154
housekeepingPeriod = time.Second * 2
152155

@@ -189,10 +192,15 @@ const (
189192
eventedPlegMaxStreamRetries = 5
190193

191194
// backOffPeriod is the period to back off when pod syncing results in an
192-
// error. It is also used as the base period for the exponential backoff
193-
// container restarts and image pulls.
195+
// error.
194196
backOffPeriod = time.Second * 10
195197

198+
// Initial period for the exponential backoff for container restarts.
199+
containerBackOffPeriod = time.Second * 10
200+
201+
// Initial period for the exponential backoff for image pulls.
202+
imageBackOffPeriod = time.Second * 10
203+
196204
// ContainerGCPeriod is the period for performing container garbage collection.
197205
ContainerGCPeriod = time.Minute
198206
// ImageGCPeriod is the period for performing image garbage collection.
@@ -615,7 +623,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
615623
machineInfo.Timestamp = time.Time{}
616624
klet.setCachedMachineInfo(machineInfo)
617625

618-
imageBackOff := flowcontrol.NewBackOff(backOffPeriod, MaxContainerBackOff)
626+
imageBackOff := flowcontrol.NewBackOff(imageBackOffPeriod, MaxImageBackOff)
619627

620628
klet.livenessManager = proberesults.NewManager()
621629
klet.readinessManager = proberesults.NewManager()
@@ -874,7 +882,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
874882
kubeDeps.Recorder,
875883
volumepathhandler.NewBlockVolumePathHandler())
876884

877-
klet.backOff = flowcontrol.NewBackOff(backOffPeriod, MaxContainerBackOff)
885+
klet.backOff = flowcontrol.NewBackOff(containerBackOffPeriod, MaxContainerBackOff)
878886

879887
// setup eviction manager
880888
evictionManager, evictionAdmitHandler := eviction.NewManager(klet.resourceAnalyzer, evictionConfig,

0 commit comments

Comments
 (0)