Kubelet: only apply default hard evictions of nodefs.inodesFree on Linux

pull/8/head
Pengfei Ni 2018-09-03 15:15:28 +08:00
parent 058b26f38e
commit e1fdaa177f
5 changed files with 57 additions and 12 deletions

View File

@ -81,12 +81,7 @@ func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
obj.KubeAPIQPS = 5 obj.KubeAPIQPS = 5
obj.KubeAPIBurst = 10 obj.KubeAPIBurst = 10
obj.HairpinMode = v1beta1.PromiscuousBridge obj.HairpinMode = v1beta1.PromiscuousBridge
obj.EvictionHard = map[string]string{ obj.EvictionHard = kubeletconfigv1beta1.DefaultEvictionHard
"memory.available": "100Mi",
"nodefs.available": "10%",
"nodefs.inodesFree": "5%",
"imagefs.available": "15%",
}
obj.EvictionPressureTransitionPeriod = metav1.Duration{Duration: 5 * time.Minute} obj.EvictionPressureTransitionPeriod = metav1.Duration{Duration: 5 * time.Minute}
obj.MakeIPTablesUtilChains = true obj.MakeIPTablesUtilChains = true
obj.IPTablesMasqueradeBit = kubeletconfigv1beta1.DefaultIPTablesMasqueradeBit obj.IPTablesMasqueradeBit = kubeletconfigv1beta1.DefaultIPTablesMasqueradeBit

View File

@ -9,6 +9,8 @@ go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"defaults.go", "defaults.go",
"defaults_linux.go",
"defaults_others.go",
"doc.go", "doc.go",
"register.go", "register.go",
"zz_generated.conversion.go", "zz_generated.conversion.go",

View File

@ -178,12 +178,7 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
obj.SerializeImagePulls = utilpointer.BoolPtr(true) obj.SerializeImagePulls = utilpointer.BoolPtr(true)
} }
if obj.EvictionHard == nil { if obj.EvictionHard == nil {
obj.EvictionHard = map[string]string{ obj.EvictionHard = DefaultEvictionHard
"memory.available": "100Mi",
"nodefs.available": "10%",
"nodefs.inodesFree": "5%",
"imagefs.available": "15%",
}
} }
if obj.EvictionPressureTransitionPeriod == zeroDuration { if obj.EvictionPressureTransitionPeriod == zeroDuration {
obj.EvictionPressureTransitionPeriod = metav1.Duration{Duration: 5 * time.Minute} obj.EvictionPressureTransitionPeriod = metav1.Duration{Duration: 5 * time.Minute}

View File

@ -0,0 +1,27 @@
// +build linux
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
// DefaultEvictionHard includes default options for hard eviction.
var DefaultEvictionHard = map[string]string{
"memory.available": "100Mi",
"nodefs.available": "10%",
"nodefs.inodesFree": "5%",
"imagefs.available": "15%",
}

View File

@ -0,0 +1,26 @@
// +build !linux
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
// DefaultEvictionHard includes default options for hard eviction.
var DefaultEvictionHard = map[string]string{
"memory.available": "100Mi",
"nodefs.available": "10%",
"imagefs.available": "15%",
}