Skip to content

Commit 809f1ba

Browse files
rphillipsbertinatto
authored andcommitted
UPSTREAM: <carry>: add max_housekeeping_interval
OpenShift-Rebase-Source: 3b2555a
1 parent 4031cc7 commit 809f1ba

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
@@ -59,10 +59,17 @@ const defaultHousekeepingInterval = 10 * time.Second
5959
const allowDynamicHousekeeping = true
6060

6161
func init() {
62+
maxHouseKeeping := maxHousekeepingInterval.String()
63+
if value := os.Getenv("OPENSHIFT_MAX_HOUSEKEEPING_INTERVAL_DURATION"); value != "" {
64+
klog.Infof("Detected OPENSHIFT_MAX_HOUSEKEEPING_INTERVAL_DURATION: %v", value)
65+
maxHouseKeeping = value
66+
}
6267
// Override cAdvisor flag defaults.
6368
flagOverrides := map[string]string{
6469
// Override the default cAdvisor housekeeping interval.
6570
"housekeeping_interval": defaultHousekeepingInterval.String(),
71+
// Override the default max cAdvisor housekeeping interval.
72+
"max_housekeeping_interval": maxHouseKeeping,
6673
// Disable event storage by default.
6774
"event_storage_event_limit": "default=0",
6875
"event_storage_age_limit": "default=0",

pkg/kubelet/kubelet.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@ const (
171171
// the cache.
172172
runtimeCacheRefreshPeriod = housekeepingPeriod + housekeepingWarningDuration
173173

174-
// Period for performing eviction monitoring.
175-
// ensure this is kept in sync with internal cadvisor housekeeping.
176-
evictionMonitoringPeriod = time.Second * 10
177-
178174
// The path in containers' filesystems where the hosts file is mounted.
179175
linuxEtcHostsPath = "/etc/hosts"
180176
windowsEtcHostsPath = "C:\\Windows\\System32\\drivers\\etc\\hosts"
@@ -251,8 +247,21 @@ var (
251247

252248
// This is exposed for unit tests.
253249
goos = sysruntime.GOOS
250+
251+
// Period for performing eviction monitoring.
252+
// ensure this is kept in sync with internal cadvisor housekeeping.
253+
evictionMonitoringPeriod = time.Second * 10
254254
)
255255

256+
func init() {
257+
if value := os.Getenv("OPENSHIFT_EVICTION_MONITORING_PERIOD_DURATION"); value != "" {
258+
if duration, err := time.ParseDuration(value); err == nil {
259+
klog.Infof("Detected OPENSHIFT_EVICTION_MONITORING_PERIOD_DURATION: %v", value)
260+
evictionMonitoringPeriod = duration
261+
}
262+
}
263+
}
264+
256265
func getContainerEtcHostsPath() string {
257266
if goos == "windows" {
258267
return windowsEtcHostsPath

0 commit comments

Comments
 (0)