Commit 2c01edf9 authored by derekwaynecarr's avatar derekwaynecarr

Add eviction-pressure-transition-period flag to kubelet

parent 08440b5d
...@@ -237,6 +237,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string ...@@ -237,6 +237,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
3*time.Second, /* NodeStatusUpdateFrequency */ 3*time.Second, /* NodeStatusUpdateFrequency */
10*time.Second, /* SyncFrequency */ 10*time.Second, /* SyncFrequency */
10*time.Second, /* OutOfDiskTransitionFrequency */ 10*time.Second, /* OutOfDiskTransitionFrequency */
10*time.Second, /* EvictionPressureTransitionPeriod */
40, /* MaxPods */ 40, /* MaxPods */
cm, net.ParseIP("127.0.0.1")) cm, net.ParseIP("127.0.0.1"))
...@@ -269,7 +270,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string ...@@ -269,7 +270,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
3*time.Second, /* NodeStatusUpdateFrequency */ 3*time.Second, /* NodeStatusUpdateFrequency */
10*time.Second, /* SyncFrequency */ 10*time.Second, /* SyncFrequency */
10*time.Second, /* OutOfDiskTransitionFrequency */ 10*time.Second, /* OutOfDiskTransitionFrequency */
10*time.Second, /* EvictionPressureTransitionPeriod */
40, /* MaxPods */ 40, /* MaxPods */
cm, cm,
net.ParseIP("127.0.0.1")) net.ParseIP("127.0.0.1"))
......
...@@ -141,6 +141,7 @@ func NewKubeletServer() *KubeletServer { ...@@ -141,6 +141,7 @@ func NewKubeletServer() *KubeletServer {
OutOfDiskTransitionFrequency: unversioned.Duration{Duration: 5 * time.Minute}, OutOfDiskTransitionFrequency: unversioned.Duration{Duration: 5 * time.Minute},
HairpinMode: componentconfig.PromiscuousBridge, HairpinMode: componentconfig.PromiscuousBridge,
BabysitDaemons: false, BabysitDaemons: false,
EvictionPressureTransitionPeriod: unversioned.Duration{Duration: 5 * time.Minute},
}, },
} }
} }
...@@ -255,4 +256,5 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) { ...@@ -255,4 +256,5 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.EvictionHard, "eviction-hard", s.EvictionHard, "A set of eviction thresholds (e.g. memory.available<1Gi) that if met would trigger a pod eviction.") fs.StringVar(&s.EvictionHard, "eviction-hard", s.EvictionHard, "A set of eviction thresholds (e.g. memory.available<1Gi) that if met would trigger a pod eviction.")
fs.StringVar(&s.EvictionSoft, "eviction-soft", s.EvictionSoft, "A set of eviction thresholds (e.g. memory.available<1.5Gi) that if met over a corresponding grace period would trigger a pod eviction.") fs.StringVar(&s.EvictionSoft, "eviction-soft", s.EvictionSoft, "A set of eviction thresholds (e.g. memory.available<1.5Gi) that if met over a corresponding grace period would trigger a pod eviction.")
fs.StringVar(&s.EvictionSoftGracePeriod, "eviction-soft-grace-period", s.EvictionSoftGracePeriod, "A set of eviction grace periods (e.g. memory.available=1m30s) that correspond to how long a soft eviction threshold must hold before triggering a pod eviction.") fs.StringVar(&s.EvictionSoftGracePeriod, "eviction-soft-grace-period", s.EvictionSoftGracePeriod, "A set of eviction grace periods (e.g. memory.available=1m30s) that correspond to how long a soft eviction threshold must hold before triggering a pod eviction.")
fs.DurationVar(&s.EvictionPressureTransitionPeriod.Duration, "eviction-pressure-transition-period", s.EvictionPressureTransitionPeriod.Duration, "Duration for which the kubelet has to wait before transitioning out of an eviction pressure condition.")
} }
...@@ -188,6 +188,10 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) { ...@@ -188,6 +188,10 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
evictionConfig := eviction.Config{
PressureTransitionPeriod: s.EvictionPressureTransitionPeriod.Duration,
Thresholds: thresholds,
}
return &KubeletConfig{ return &KubeletConfig{
Address: net.ParseIP(s.Address), Address: net.ParseIP(s.Address),
...@@ -268,7 +272,7 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) { ...@@ -268,7 +272,7 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
BabysitDaemons: s.BabysitDaemons, BabysitDaemons: s.BabysitDaemons,
ExperimentalFlannelOverlay: s.ExperimentalFlannelOverlay, ExperimentalFlannelOverlay: s.ExperimentalFlannelOverlay,
NodeIP: net.ParseIP(s.NodeIP), NodeIP: net.ParseIP(s.NodeIP),
Thresholds: thresholds, EvictionConfig: evictionConfig,
}, nil }, nil
} }
...@@ -513,7 +517,7 @@ func SimpleKubelet(client *clientset.Clientset, ...@@ -513,7 +517,7 @@ func SimpleKubelet(client *clientset.Clientset,
configFilePath string, configFilePath string,
cloud cloudprovider.Interface, cloud cloudprovider.Interface,
osInterface kubecontainer.OSInterface, osInterface kubecontainer.OSInterface,
fileCheckFrequency, httpCheckFrequency, minimumGCAge, nodeStatusUpdateFrequency, syncFrequency, outOfDiskTransitionFrequency time.Duration, fileCheckFrequency, httpCheckFrequency, minimumGCAge, nodeStatusUpdateFrequency, syncFrequency, outOfDiskTransitionFrequency, evictionPressureTransitionPeriod time.Duration,
maxPods int, maxPods int,
containerManager cm.ContainerManager, clusterDNS net.IP) *KubeletConfig { containerManager cm.ContainerManager, clusterDNS net.IP) *KubeletConfig {
imageGCPolicy := kubelet.ImageGCPolicy{ imageGCPolicy := kubelet.ImageGCPolicy{
...@@ -524,7 +528,9 @@ func SimpleKubelet(client *clientset.Clientset, ...@@ -524,7 +528,9 @@ func SimpleKubelet(client *clientset.Clientset,
DockerFreeDiskMB: 256, DockerFreeDiskMB: 256,
RootFreeDiskMB: 256, RootFreeDiskMB: 256,
} }
evictionConfig := eviction.Config{
PressureTransitionPeriod: evictionPressureTransitionPeriod,
}
kcfg := KubeletConfig{ kcfg := KubeletConfig{
Address: net.ParseIP(address), Address: net.ParseIP(address),
CAdvisorInterface: cadvisorInterface, CAdvisorInterface: cadvisorInterface,
...@@ -582,6 +588,7 @@ func SimpleKubelet(client *clientset.Clientset, ...@@ -582,6 +588,7 @@ func SimpleKubelet(client *clientset.Clientset,
VolumePlugins: volumePlugins, VolumePlugins: volumePlugins,
Writer: &io.StdWriter{}, Writer: &io.StdWriter{},
OutOfDiskTransitionFrequency: outOfDiskTransitionFrequency, OutOfDiskTransitionFrequency: outOfDiskTransitionFrequency,
EvictionConfig: evictionConfig,
} }
return &kcfg return &kcfg
} }
...@@ -783,7 +790,7 @@ type KubeletConfig struct { ...@@ -783,7 +790,7 @@ type KubeletConfig struct {
Writer io.Writer Writer io.Writer
VolumePlugins []volume.VolumePlugin VolumePlugins []volume.VolumePlugin
OutOfDiskTransitionFrequency time.Duration OutOfDiskTransitionFrequency time.Duration
Thresholds []eviction.Threshold EvictionConfig eviction.Config
ExperimentalFlannelOverlay bool ExperimentalFlannelOverlay bool
NodeIP net.IP NodeIP net.IP
...@@ -880,7 +887,7 @@ func CreateAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod ...@@ -880,7 +887,7 @@ func CreateAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod
kc.ContainerRuntimeOptions, kc.ContainerRuntimeOptions,
kc.HairpinMode, kc.HairpinMode,
kc.BabysitDaemons, kc.BabysitDaemons,
kc.Thresholds, kc.EvictionConfig,
kc.Options, kc.Options,
) )
......
...@@ -121,6 +121,7 @@ event-ttl ...@@ -121,6 +121,7 @@ event-ttl
eviction-hard eviction-hard
eviction-soft eviction-soft
eviction-soft-grace-period eviction-soft-grace-period
eviction-pressure-transition-period
executor-bindall executor-bindall
executor-logv executor-logv
executor-path executor-path
......
...@@ -349,6 +349,8 @@ type KubeletConfiguration struct { ...@@ -349,6 +349,8 @@ type KubeletConfiguration struct {
EvictionSoft string `json:"evictionSoft,omitempty"` EvictionSoft string `json:"evictionSoft,omitempty"`
// Comma-delimeted list of grace periods for each soft eviction signal. For example, 'memory.available=30s'. // Comma-delimeted list of grace periods for each soft eviction signal. For example, 'memory.available=30s'.
EvictionSoftGracePeriod string `json:"evictionSoftGracePeriod,omitempty"` EvictionSoftGracePeriod string `json:"evictionSoftGracePeriod,omitempty"`
// Duration for which the kubelet has to wait before transitioning out of an eviction pressure condition.
EvictionPressureTransitionPeriod unversioned.Duration `json:"evictionPressureTransitionPeriod,omitempty"`
} }
type KubeSchedulerConfiguration struct { type KubeSchedulerConfiguration struct {
......
...@@ -38,6 +38,14 @@ const ( ...@@ -38,6 +38,14 @@ const (
OpLessThan ThresholdOperator = "LessThan" OpLessThan ThresholdOperator = "LessThan"
) )
// Config holds information about how eviction is configured.
type Config struct {
// PressureTransitionPeriod is duration the kubelet has to wait before transititioning out of a pressure condition.
PressureTransitionPeriod time.Duration
// Thresholds define the set of conditions monitored to trigger eviction.
Thresholds []Threshold
}
// Threshold defines a metric for when eviction should occur. // Threshold defines a metric for when eviction should occur.
type Threshold struct { type Threshold struct {
// Signal defines the entity that was measured. // Signal defines the entity that was measured.
......
...@@ -223,7 +223,7 @@ func NewMainKubelet( ...@@ -223,7 +223,7 @@ func NewMainKubelet(
containerRuntimeOptions []kubecontainer.Option, containerRuntimeOptions []kubecontainer.Option,
hairpinMode string, hairpinMode string,
babysitDaemons bool, babysitDaemons bool,
thresholds []eviction.Threshold, evictionConfig eviction.Config,
kubeOptions []Option, kubeOptions []Option,
) (*Kubelet, error) { ) (*Kubelet, error) {
if rootDirectory == "" { if rootDirectory == "" {
......
...@@ -72,6 +72,7 @@ func NewHollowKubelet( ...@@ -72,6 +72,7 @@ func NewHollowKubelet(
10*time.Second, /* NodeStatusUpdateFrequency */ 10*time.Second, /* NodeStatusUpdateFrequency */
10*time.Second, /* SyncFrequency */ 10*time.Second, /* SyncFrequency */
5*time.Minute, /* OutOfDiskTransitionFrequency */ 5*time.Minute, /* OutOfDiskTransitionFrequency */
5*time.Minute, /* EvictionPressureTransitionPeriod */
maxPods, maxPods,
containerManager, containerManager,
nil, nil,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment