Skip to content

Commit

Permalink
kubelet calls GetDirFsInfo(root directory) instead of using GetFsInfo…
Browse files Browse the repository at this point in the history
…(root label). Reverted kubernetes#33520, and changed e2e test context to use nodefs
  • Loading branch information
dashpole authored and jessfraz committed Oct 28, 2016
1 parent a73aaa8 commit 2f44e21
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
7 changes: 1 addition & 6 deletions cluster/gce/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,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:-}"
7 changes: 1 addition & 6 deletions cluster/gce/config-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,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:-}"
2 changes: 1 addition & 1 deletion cmd/kubelet/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,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
}
Expand Down
12 changes: 7 additions & 5 deletions pkg/kubelet/cadvisor/cadvisor_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import (
)

type cadvisorClient struct {
runtime string
runtime string
rootPath string
manager.Manager
}

Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ 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.")
}
2 changes: 1 addition & 1 deletion test/e2e_node/environment/conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 2f44e21

Please sign in to comment.