Skip to content

Commit 7b50d93

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

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

cmd/kubelet/app/options/globalflags_linux.go

Lines changed: 1 addition & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ const (
184184
// the cache.
185185
runtimeCacheRefreshPeriod = housekeepingPeriod + housekeepingWarningDuration
186186

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

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

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

0 commit comments

Comments
 (0)