Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d9a294d

Browse files
dashpolejessfraz
authored andcommitted
kubelet calls GetDirFsInfo(root directory) instead of using GetFsInfo(root label). Reverted kubernetes#33520, and changed e2e test context to use nodefs
1 parent a2cde96 commit d9a294d

6 files changed

Lines changed: 12 additions & 20 deletions

File tree

cluster/gce/config-default.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,7 @@ HAIRPIN_MODE="${HAIRPIN_MODE:-promiscuous-bridge}" # promiscuous-bridge, hairpin
161161
E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false}
162162

163163
# Evict pods whenever compute resource availability on the nodes gets below a threshold.
164-
# TODO: Get rid of the conditionals once https://github.com/kubernetes/kubernetes/issues/33444 is resolved.
165-
if [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then
166-
EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%}"
167-
else
168-
EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,imagefs.available<10%,imagefs.inodesFree<5%}"
169-
fi
164+
EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%}"
170165

171166
# Optional: custom scheduling algorithm
172167
SCHEDULING_ALGORITHM_PROVIDER="${SCHEDULING_ALGORITHM_PROVIDER:-}"

cluster/gce/config-test.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,7 @@ E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false}
196196
PREPULL_E2E_IMAGES="${PREPULL_E2E_IMAGES:-true}"
197197

198198
# Evict pods whenever compute resource availability on the nodes gets below a threshold.
199-
# TODO: Get rid of the conditionals once https://github.com/kubernetes/kubernetes/issues/33444 is resolved.
200-
if [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then
201-
EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%}"
202-
else
203-
EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,imagefs.available<10%,imagefs.inodesFree<5%}"
204-
fi
199+
EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%}"
205200

206201
# Optional: custom scheduling algorithm
207202
SCHEDULING_ALGORITHM_PROVIDER="${SCHEDULING_ALGORITHM_PROVIDER:-}"

cmd/kubelet/app/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.KubeletDeps) (err error) {
395395
}
396396

397397
if kubeDeps.CAdvisorInterface == nil {
398-
kubeDeps.CAdvisorInterface, err = cadvisor.New(uint(s.CAdvisorPort), s.ContainerRuntime)
398+
kubeDeps.CAdvisorInterface, err = cadvisor.New(uint(s.CAdvisorPort), s.ContainerRuntime, s.RootDirectory)
399399
if err != nil {
400400
return err
401401
}

pkg/kubelet/cadvisor/cadvisor_linux.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ import (
4040
)
4141

4242
type cadvisorClient struct {
43-
runtime string
43+
runtime string
44+
rootPath string
4445
manager.Manager
4546
}
4647

@@ -93,7 +94,7 @@ func containerLabels(c *cadvisorapi.ContainerInfo) map[string]string {
9394
}
9495

9596
// New creates a cAdvisor and exports its API on the specified port if port > 0.
96-
func New(port uint, runtime string) (Interface, error) {
97+
func New(port uint, runtime string, rootPath string) (Interface, error) {
9798
sysFs, err := sysfs.NewRealSysFs()
9899
if err != nil {
99100
return nil, err
@@ -106,8 +107,9 @@ func New(port uint, runtime string) (Interface, error) {
106107
}
107108

108109
cadvisorClient := &cadvisorClient{
109-
runtime: runtime,
110-
Manager: m,
110+
runtime: runtime,
111+
rootPath: rootPath,
112+
Manager: m,
111113
}
112114

113115
err = cadvisorClient.exportHTTP(port)
@@ -202,7 +204,7 @@ func (cc *cadvisorClient) ImagesFsInfo() (cadvisorapiv2.FsInfo, error) {
202204
}
203205

204206
func (cc *cadvisorClient) RootFsInfo() (cadvisorapiv2.FsInfo, error) {
205-
return cc.getFsInfo(cadvisorfs.LabelSystemRoot)
207+
return cc.GetDirFsInfo(cc.rootPath)
206208
}
207209

208210
func (cc *cadvisorClient) getFsInfo(label string) (cadvisorapiv2.FsInfo, error) {

test/e2e/framework/test_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,6 @@ func RegisterNodeFlags() {
175175
flag.BoolVar(&TestContext.DisableKubenet, "disable-kubenet", false, "If true, start kubelet without kubenet. (default false)")
176176
// TODO: uncomment this when the flag is re-enabled in kubelet
177177
//flag.BoolVar(&TestContext.CgroupsPerQOS, "cgroups-per-qos", false, "Enable creation of QoS cgroup hierarchy, if true top level QoS and pod cgroups are created.")
178-
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.")
178+
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.")
179179
flag.StringVar(&TestContext.ManifestPath, "manifest-path", "", "The path to the static pod manifest file.")
180180
}

test/e2e_node/environment/conformance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func containerRuntime() error {
9999
}
100100

101101
// Setup cadvisor to check the container environment
102-
c, err := cadvisor.New(0 /*don't start the http server*/, "docker")
102+
c, err := cadvisor.New(0 /*don't start the http server*/, "docker", "/var/lib/kubelet")
103103
if err != nil {
104104
return printError("Container Runtime Check: %s Could not start cadvisor %v", failed, err)
105105
}

0 commit comments

Comments
 (0)