Skip to content

Commit dd4ac52

Browse files
rphillipsbertinatto
authored andcommitted
UPSTREAM: <carry>: add max_housekeeping_interval
OpenShift-Rebase-Source: 3b2555a
1 parent f3860e2 commit dd4ac52

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

cmd/kubelet/app/options/globalflags_linux.go

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func addCadvisorFlags(fs *pflag.FlagSet) {
4242

4343
// e2e node tests rely on this
4444
register(global, local, "housekeeping_interval")
45+
register(global, local, "max_housekeeping_interval")
4546

4647
// These flags were implicit from cadvisor, and are mistakes that should be registered deprecated:
4748
const deprecated = "This is a cadvisor flag that was mistakenly registered with the Kubelet. Due to legacy concerns, it will follow the standard CLI deprecation timeline before being removed."

pkg/kubelet/cadvisor/cadvisor_linux.go

+7
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,17 @@ const defaultHousekeepingInterval = 10 * time.Second
6161
const allowDynamicHousekeeping = true
6262

6363
func init() {
64+
maxHouseKeeping := maxHousekeepingInterval.String()
65+
if value := os.Getenv("OPENSHIFT_MAX_HOUSEKEEPING_INTERVAL_DURATION"); value != "" {
66+
klog.Infof("Detected OPENSHIFT_MAX_HOUSEKEEPING_INTERVAL_DURATION: %v", value)
67+
maxHouseKeeping = value
68+
}
6469
// Override cAdvisor flag defaults.
6570
flagOverrides := map[string]string{
6671
// Override the default cAdvisor housekeeping interval.
6772
"housekeeping_interval": defaultHousekeepingInterval.String(),
73+
// Override the default max cAdvisor housekeeping interval.
74+
"max_housekeeping_interval": maxHouseKeeping,
6875
// Disable event storage by default.
6976
"event_storage_event_limit": "default=0",
7077
"event_storage_age_limit": "default=0",

pkg/kubelet/kubelet.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ const (
185185
// the cache.
186186
runtimeCacheRefreshPeriod = housekeepingPeriod + housekeepingWarningDuration
187187

188-
// Period for performing eviction monitoring.
189-
// ensure this is kept in sync with internal cadvisor housekeeping.
190-
evictionMonitoringPeriod = time.Second * 10
191-
192188
// The path in containers' filesystems where the hosts file is mounted.
193189
linuxEtcHostsPath = "/etc/hosts"
194190
windowsEtcHostsPath = "C:\\Windows\\System32\\drivers\\etc\\hosts"
@@ -263,8 +259,21 @@ var (
263259

264260
// This is exposed for unit tests.
265261
goos = sysruntime.GOOS
262+
263+
// Period for performing eviction monitoring.
264+
// ensure this is kept in sync with internal cadvisor housekeeping.
265+
evictionMonitoringPeriod = time.Second * 10
266266
)
267267

268+
func init() {
269+
if value := os.Getenv("OPENSHIFT_EVICTION_MONITORING_PERIOD_DURATION"); value != "" {
270+
if duration, err := time.ParseDuration(value); err == nil {
271+
klog.Infof("Detected OPENSHIFT_EVICTION_MONITORING_PERIOD_DURATION: %v", value)
272+
evictionMonitoringPeriod = duration
273+
}
274+
}
275+
}
276+
268277
func getContainerEtcHostsPath() string {
269278
if goos == "windows" {
270279
return windowsEtcHostsPath

0 commit comments

Comments
 (0)