Skip to content

Commit 3b2555a

Browse files
rphillipssoltysh
authored andcommitted
UPSTREAM: <carry>: add max_housekeeping_interval
openshift-rebase(v1.24):source=ea2d15e503c
1 parent cd08005 commit 3b2555a

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-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

+15-4
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ const (
142142
// housekeeping is running no new pods are started or deleted).
143143
housekeepingWarningDuration = time.Second * 15
144144

145-
// Period for performing eviction monitoring.
146-
// ensure this is kept in sync with internal cadvisor housekeeping.
147-
evictionMonitoringPeriod = time.Second * 10
148-
149145
// The path in containers' filesystems where the hosts file is mounted.
150146
linuxEtcHostsPath = "/etc/hosts"
151147
windowsEtcHostsPath = "C:\\Windows\\System32\\drivers\\etc\\hosts"
@@ -181,6 +177,21 @@ const (
181177
nodeLeaseRenewIntervalFraction = 0.25
182178
)
183179

180+
var (
181+
// Period for performing eviction monitoring.
182+
// ensure this is kept in sync with internal cadvisor housekeeping.
183+
evictionMonitoringPeriod = time.Second * 10
184+
)
185+
186+
func init() {
187+
if value := os.Getenv("OPENSHIFT_EVICTION_MONITORING_PERIOD_DURATION"); value != "" {
188+
if duration, err := time.ParseDuration(value); err == nil {
189+
klog.Infof("Detected OPENSHIFT_EVICTION_MONITORING_PERIOD_DURATION: %v", value)
190+
evictionMonitoringPeriod = duration
191+
}
192+
}
193+
}
194+
184195
var etcHostsPath = getContainerEtcHostsPath()
185196

186197
func getContainerEtcHostsPath() string {

0 commit comments

Comments
 (0)