Skip to content

Commit

Permalink
UPSTREAM: <carry>: add max_housekeeping_interval
Browse files Browse the repository at this point in the history
openshift-rebase(v1.24):source=ea2d15e503c
  • Loading branch information
rphillips authored and soltysh committed Aug 22, 2022
1 parent 19d4525 commit 5e646cf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/kubelet/app/options/globalflags_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func addCadvisorFlags(fs *pflag.FlagSet) {

// e2e node tests rely on this
register(global, local, "housekeeping_interval")
register(global, local, "max_housekeeping_interval")

// These flags were implicit from cadvisor, and are mistakes that should be registered deprecated:
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."
Expand Down
7 changes: 7 additions & 0 deletions pkg/kubelet/cadvisor/cadvisor_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ const defaultHousekeepingInterval = 10 * time.Second
const allowDynamicHousekeeping = true

func init() {
maxHouseKeeping := maxHousekeepingInterval.String()
if value := os.Getenv("OPENSHIFT_MAX_HOUSEKEEPING_INTERVAL_DURATION"); value != "" {
klog.Infof("Detected OPENSHIFT_MAX_HOUSEKEEPING_INTERVAL_DURATION: %v", value)
maxHouseKeeping = value
}
// Override cAdvisor flag defaults.
flagOverrides := map[string]string{
// Override the default cAdvisor housekeeping interval.
"housekeeping_interval": defaultHousekeepingInterval.String(),
// Override the default max cAdvisor housekeeping interval.
"max_housekeeping_interval": maxHouseKeeping,
// Disable event storage by default.
"event_storage_event_limit": "default=0",
"event_storage_age_limit": "default=0",
Expand Down
19 changes: 15 additions & 4 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ const (
// housekeeping is running no new pods are started or deleted).
housekeepingWarningDuration = time.Second * 15

// Period for performing eviction monitoring.
// ensure this is kept in sync with internal cadvisor housekeeping.
evictionMonitoringPeriod = time.Second * 10

// The path in containers' filesystems where the hosts file is mounted.
linuxEtcHostsPath = "/etc/hosts"
windowsEtcHostsPath = "C:\\Windows\\System32\\drivers\\etc\\hosts"
Expand Down Expand Up @@ -181,6 +177,21 @@ const (
nodeLeaseRenewIntervalFraction = 0.25
)

var (
// Period for performing eviction monitoring.
// ensure this is kept in sync with internal cadvisor housekeeping.
evictionMonitoringPeriod = time.Second * 10
)

func init() {
if value := os.Getenv("OPENSHIFT_EVICTION_MONITORING_PERIOD_DURATION"); value != "" {
if duration, err := time.ParseDuration(value); err == nil {
klog.Infof("Detected OPENSHIFT_EVICTION_MONITORING_PERIOD_DURATION: %v", value)
evictionMonitoringPeriod = duration
}
}
}

var etcHostsPath = getContainerEtcHostsPath()

func getContainerEtcHostsPath() string {
Expand Down

0 comments on commit 5e646cf

Please sign in to comment.