diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index c6c6fb4d79c..47ae2ebb299 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -163,12 +163,7 @@ HAIRPIN_MODE="${HAIRPIN_MODE:-promiscuous-bridge}" # promiscuous-bridge, hairpin E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false} # Evict pods whenever compute resource availability on the nodes gets below a threshold. -# TODO: Get rid of the conditionals once https://github.com/kubernetes/kubernetes/issues/33444 is resolved. -if [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then - EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%}" -else - EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,imagefs.available<10%,imagefs.inodesFree<5%}" -fi +EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%}" # Optional: custom scheduling algorithm SCHEDULING_ALGORITHM_PROVIDER="${SCHEDULING_ALGORITHM_PROVIDER:-}" diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 930247045da..658f3451ebb 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -198,12 +198,7 @@ E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false} PREPULL_E2E_IMAGES="${PREPULL_E2E_IMAGES:-true}" # Evict pods whenever compute resource availability on the nodes gets below a threshold. -# TODO: Get rid of the conditionals once https://github.com/kubernetes/kubernetes/issues/33444 is resolved. -if [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then - EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%}" -else - EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,imagefs.available<10%,imagefs.inodesFree<5%}" -fi +EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%}" # Optional: custom scheduling algorithm SCHEDULING_ALGORITHM_PROVIDER="${SCHEDULING_ALGORITHM_PROVIDER:-}" diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index d13d7293685..5cc89b0c6a5 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -413,7 +413,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.KubeletDeps) (err error) { } if kubeDeps.CAdvisorInterface == nil { - kubeDeps.CAdvisorInterface, err = cadvisor.New(uint(s.CAdvisorPort), s.ContainerRuntime) + kubeDeps.CAdvisorInterface, err = cadvisor.New(uint(s.CAdvisorPort), s.ContainerRuntime, s.RootDirectory) if err != nil { return err } diff --git a/pkg/kubelet/cadvisor/cadvisor_linux.go b/pkg/kubelet/cadvisor/cadvisor_linux.go index 853e0d5d566..98db0ef3c3f 100644 --- a/pkg/kubelet/cadvisor/cadvisor_linux.go +++ b/pkg/kubelet/cadvisor/cadvisor_linux.go @@ -40,7 +40,8 @@ import ( ) type cadvisorClient struct { - runtime string + runtime string + rootPath string manager.Manager } @@ -93,7 +94,7 @@ func containerLabels(c *cadvisorapi.ContainerInfo) map[string]string { } // New creates a cAdvisor and exports its API on the specified port if port > 0. -func New(port uint, runtime string) (Interface, error) { +func New(port uint, runtime string, rootPath string) (Interface, error) { sysFs, err := sysfs.NewRealSysFs() if err != nil { return nil, err @@ -106,8 +107,9 @@ func New(port uint, runtime string) (Interface, error) { } cadvisorClient := &cadvisorClient{ - runtime: runtime, - Manager: m, + runtime: runtime, + rootPath: rootPath, + Manager: m, } err = cadvisorClient.exportHTTP(port) @@ -202,7 +204,7 @@ func (cc *cadvisorClient) ImagesFsInfo() (cadvisorapiv2.FsInfo, error) { } func (cc *cadvisorClient) RootFsInfo() (cadvisorapiv2.FsInfo, error) { - return cc.getFsInfo(cadvisorfs.LabelSystemRoot) + return cc.GetDirFsInfo(cc.rootPath) } func (cc *cadvisorClient) getFsInfo(label string) (cadvisorapiv2.FsInfo, error) { diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 1e09b7bafc5..b43d2ec8250 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -212,7 +212,7 @@ func RegisterNodeFlags() { flag.BoolVar(&TestContext.DisableKubenet, "disable-kubenet", false, "If true, start kubelet without kubenet. (default false)") // TODO: uncomment this when the flag is re-enabled in kubelet //flag.BoolVar(&TestContext.CgroupsPerQOS, "cgroups-per-qos", false, "Enable creation of QoS cgroup hierarchy, if true top level QoS and pod cgroups are created.") - flag.StringVar(&TestContext.EvictionHard, "eviction-hard", "memory.available<250Mi,imagefs.available<10%", "The hard eviction thresholds. If set, pods get evicted when the specified resources drop below the thresholds.") + flag.StringVar(&TestContext.EvictionHard, "eviction-hard", "memory.available<250Mi,nodefs.available<10%,nodefs.inodesFree<5%", "The hard eviction thresholds. If set, pods get evicted when the specified resources drop below the thresholds.") flag.StringVar(&TestContext.ManifestPath, "manifest-path", "", "The path to the static pod manifest file.") flag.BoolVar(&TestContext.PrepullImages, "prepull-images", true, "If true, prepull images so image pull failures do not cause test failures.") flag.StringVar(&TestContext.RuntimeIntegrationType, "runtime-integration-type", "", "Choose the integration path for the container runtime, mainly used for CRI validation.") diff --git a/test/e2e_node/environment/conformance.go b/test/e2e_node/environment/conformance.go index 2a1b3262b2a..11e4d0065af 100644 --- a/test/e2e_node/environment/conformance.go +++ b/test/e2e_node/environment/conformance.go @@ -99,7 +99,7 @@ func containerRuntime() error { } // Setup cadvisor to check the container environment - c, err := cadvisor.New(0 /*don't start the http server*/, "docker") + c, err := cadvisor.New(0 /*don't start the http server*/, "docker", "/var/lib/kubelet") if err != nil { return printError("Container Runtime Check: %s Could not start cadvisor %v", failed, err) }