From f9f91fd99dca38a363f824531f5d1bd2a7917f0a Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Wed, 23 Sep 2015 15:06:50 +0200 Subject: [PATCH 1/2] Remove cgroup list dependent e2e test from conformance test suite As discussed @gmarek the given test does not belong into the conformance test suite because it makes a lot of static assumptions about the cgroup setup of the nodes which cannot be fulfilled by all cluster providers. Depending on the installation the kubelet is not allowed to move around process into specific containers. Fixes https://github.com/mesosphere/kubernetes-mesos/issues/439. --- hack/conformance-test.sh | 2 +- hack/jenkins/e2e.sh | 4 ++-- test/e2e/monitor_resources.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hack/conformance-test.sh b/hack/conformance-test.sh index 9472d7cf188..7b649b74e81 100755 --- a/hack/conformance-test.sh +++ b/hack/conformance-test.sh @@ -103,7 +103,7 @@ echo "Conformance test checking conformance with Kubernetes version 1.0" # MaxPods\slimit\snumber\sof\spods: not sure why this wasn't working on GCE but it wasn't. # Kubectl\sclient\sSimple\spod: not sure why this wasn't working on GCE but it wasn't # DNS: not sure why this wasn't working on GCE but it wasn't -export CONFORMANCE_TEST_SKIP_REGEX="Cadvisor|MasterCerts|Density|Cluster\slevel\slogging|Etcd\sfailure|Load\sCapacity|Monitoring|Namespaces.*seconds|Pod\sdisks|Reboot|Restart|Nodes|Scale|Services.*load\sbalancer|Services.*NodePort|Services.*nodeport|Shell|SSH|Addon\supdate|Volumes|Clean\sup\spods\son\snode|Skipped|skipped|MaxPods\slimit\snumber\sof\spods|Kubectl\sclient\sSimple\spod|DNS" +export CONFORMANCE_TEST_SKIP_REGEX="Cadvisor|MasterCerts|Density|Cluster\slevel\slogging|Etcd\sfailure|Load\sCapacity|Monitoring|Namespaces.*seconds|Pod\sdisks|Reboot|Restart|Nodes|Scale|Services.*load\sbalancer|Services.*NodePort|Services.*nodeport|Shell|SSH|Addon\supdate|Volumes|Clean\sup\spods\son\snode|Skipped|skipped|MaxPods\slimit\snumber\sof\spods|Kubectl\sclient\sSimple\spod|DNS|Resource\susage\sof\ssystem\scontainers" declare -x KUBERNETES_CONFORMANCE_TEST="y" declare -x NUM_MINIONS=4 diff --git a/hack/jenkins/e2e.sh b/hack/jenkins/e2e.sh index 7dfd30cb80a..9597926e09f 100755 --- a/hack/jenkins/e2e.sh +++ b/hack/jenkins/e2e.sh @@ -117,7 +117,7 @@ GKE_REQUIRED_SKIP_TESTS=( GCE_FLAKY_TESTS=( "DaemonRestart" "Daemon\sset\sshould\slaunch\sa\sdaemon\spod\son\severy\snode\sof\sthe\scluster" - "ResourceUsage" + "Resource\susage\sof\ssystem\scontainers" "monotonically\sincreasing\srestart\scount" "should\sbe\sable\sto\schange\sthe\stype\sand\snodeport\ssettings\sof\sa\sservice" # file: service.go, issue: #13032 "allows\sscheduling\sof\spods\son\sa\sminion\safter\sit\srejoins\sthe\scluster" # file: resize_nodes.go, issue: #13258 @@ -141,7 +141,7 @@ GCE_PARALLEL_SKIP_TESTS=( "Nodes\sNetwork" "Nodes\sResize" "MaxPods" - "ResourceUsage" + "Resource\susage\sof\ssystem\scontainers" "SchedulerPredicates" "Services.*restarting" "Shell.*services" diff --git a/test/e2e/monitor_resources.go b/test/e2e/monitor_resources.go index b8403de9335..9be31ed5cef 100644 --- a/test/e2e/monitor_resources.go +++ b/test/e2e/monitor_resources.go @@ -83,9 +83,9 @@ func computeAverage(sliceOfUsages []resourceUsagePerContainer) (result resourceU return } -// This tests does nothing except checking current resource usage of containers defained in kubelet_stats systemContainers variable. +// This tests does nothing except checking current resource usage of containers defined in kubelet_stats systemContainers variable. // Test fails if an average container resource consumption over datapointAmount tries exceeds amount defined in allowedUsage. -var _ = Describe("ResourceUsage", func() { +var _ = Describe("Resource usage of system containers", func() { var c *client.Client BeforeEach(func() { var err error From 643a7f193a1d3fab617b99b8e8845395aea42b00 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Wed, 23 Sep 2015 15:25:52 +0200 Subject: [PATCH 2/2] Assume full cgroup hierarchy only on gce and gke for e2e tests Other cluster provider than gce or gke might have different cgroup layouts. From outside we cannot know how these look like (especially in conformance test which do not know the cluster provider at all). Hence, this PR defaults to only the "/" cgroup to collect stats for. In the case of gce or gke the full container list is tested. Fixes https://github.com/mesosphere/kubernetes-mesos/issues/436 --- test/e2e/kubelet.go | 2 +- test/e2e/kubelet_stats.go | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/test/e2e/kubelet.go b/test/e2e/kubelet.go index 6741e7bf63a..3d18494e2ad 100644 --- a/test/e2e/kubelet.go +++ b/test/e2e/kubelet.go @@ -103,7 +103,7 @@ var _ = Describe("kubelet", func() { for _, node := range nodes.Items { nodeNames.Insert(node.Name) } - resourceMonitor = newResourceMonitor(framework.Client, targetContainers, containerStatsPollingInterval) + resourceMonitor = newResourceMonitor(framework.Client, targetContainers(), containerStatsPollingInterval) resourceMonitor.Start() }) diff --git a/test/e2e/kubelet_stats.go b/test/e2e/kubelet_stats.go index 98fca776661..26c2e971f9c 100644 --- a/test/e2e/kubelet_stats.go +++ b/test/e2e/kubelet_stats.go @@ -178,12 +178,20 @@ const ( ) // A list of containers for which we want to collect resource usage. -var targetContainers = []string{ - "/", - "/docker-daemon", - "/kubelet", - "/kube-proxy", - "/system", +func targetContainers() []string { + if providerIs("gce", "gke") { + return []string{ + "/", + "/docker-daemon", + "/kubelet", + "/kube-proxy", + "/system", + } + } else { + return []string{ + "/", + } + } } type containerResourceUsage struct { @@ -229,8 +237,9 @@ func getOneTimeResourceUsageOnNode(c *client.Client, nodeName string, cpuInterva return nil, err } // Process container infos that are relevant to us. - usageMap := make(map[string]*containerResourceUsage, len(targetContainers)) - for _, name := range targetContainers { + containers := targetContainers() + usageMap := make(map[string]*containerResourceUsage, len(containers)) + for _, name := range containers { info, ok := containerInfos[name] if !ok { return nil, fmt.Errorf("missing info for container %q on node %q", name, nodeName) @@ -491,7 +500,7 @@ func (r *resourceMonitor) LogCPUSummary() { buf := &bytes.Buffer{} w := tabwriter.NewWriter(buf, 1, 0, 1, ' ', 0) fmt.Fprintf(w, "%s\n", strings.Join(header, "\t")) - for _, containerName := range targetContainers { + for _, containerName := range targetContainers() { data := collector.GetBasicCPUStats(containerName) var s []string s = append(s, fmt.Sprintf("%q", containerName))