Merge pull request #25372 from derekwaynecarr/more-eviction-flags

Automatic merge from submit-queue

Add eviction-pressure-transitition-period flag to kubelet

This PR does the following:
* add the new flag to control how often a node will go out of memory pressure or disk pressure conditions see: https://github.com/kubernetes/kubernetes/pull/25282
* pass an `eviction.Config` into `kubelet` so we can group config

/cc @vishh
This commit is contained in:
k8s-merge-robot 2016-05-13 05:46:15 -07:00
commit 17345bf857
11 changed files with 637 additions and 537 deletions

View File

@ -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
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"))

View File

@ -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) {
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.")
} }

View File

@ -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) {
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,
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,
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,
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 {
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
kc.ContainerRuntimeOptions, kc.ContainerRuntimeOptions,
kc.HairpinMode, kc.HairpinMode,
kc.BabysitDaemons, kc.BabysitDaemons,
kc.Thresholds, kc.EvictionConfig,
kc.Options, kc.Options,
) )

View File

@ -88,6 +88,7 @@ kubelet
--event-burst=10: Maximum size of a bursty event records, temporarily allows event records to burst to this number, while still not exceeding event-qps. Only used if --event-qps > 0 --event-burst=10: Maximum size of a bursty event records, temporarily allows event records to burst to this number, while still not exceeding event-qps. Only used if --event-qps > 0
--event-qps=5: If > 0, limit event creations per second to this value. If 0, unlimited. --event-qps=5: If > 0, limit event creations per second to this value. If 0, unlimited.
--eviction-hard="": A set of eviction thresholds (e.g. memory.available<1Gi) that if met would trigger a pod eviction. --eviction-hard="": A set of eviction thresholds (e.g. memory.available<1Gi) that if met would trigger a pod eviction.
--eviction-pressure-transition-period=5m0s: Duration for which the kubelet has to wait before transitioning out of an eviction pressure condition.
--eviction-soft="": A set of eviction thresholds (e.g. memory.available<1.5Gi) that if met over a corresponding grace period would trigger a pod eviction. --eviction-soft="": A set of eviction thresholds (e.g. memory.available<1.5Gi) that if met over a corresponding grace period would trigger a pod eviction.
--eviction-soft-grace-period="": 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. --eviction-soft-grace-period="": 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.
--experimental-flannel-overlay[=false]: Experimental support for starting the kubelet with the default overlay network (flannel). Assumes flanneld is already running in client mode. [default=false] --experimental-flannel-overlay[=false]: Experimental support for starting the kubelet with the default overlay network (flannel). Assumes flanneld is already running in client mode. [default=false]
@ -157,7 +158,7 @@ kubelet
--volume-stats-agg-period=1m0s: Specifies interval for kubelet to calculate and cache the volume disk usage for all pods and volumes. To disable volume calculations, set to 0. Default: '1m' --volume-stats-agg-period=1m0s: Specifies interval for kubelet to calculate and cache the volume disk usage for all pods and volumes. To disable volume calculations, set to 0. Default: '1m'
``` ```
###### Auto generated by spf13/cobra on 3-May-2016 ###### Auto generated by spf13/cobra on 10-May-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS --> <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->

View File

@ -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

View File

@ -308,6 +308,9 @@ func DeepCopy_componentconfig_KubeletConfiguration(in KubeletConfiguration, out
out.EvictionHard = in.EvictionHard out.EvictionHard = in.EvictionHard
out.EvictionSoft = in.EvictionSoft out.EvictionSoft = in.EvictionSoft
out.EvictionSoftGracePeriod = in.EvictionSoftGracePeriod out.EvictionSoftGracePeriod = in.EvictionSoftGracePeriod
if err := unversioned.DeepCopy_unversioned_Duration(in.EvictionPressureTransitionPeriod, &out.EvictionPressureTransitionPeriod, c); err != nil {
return err
}
return nil return nil
} }

File diff suppressed because it is too large Load Diff

View File

@ -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 {

View File

@ -39,6 +39,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.

View File

@ -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 == "" {

View File

@ -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,