diff --git a/cmd/integration/integration.go b/cmd/integration/integration.go index 431a151923..c9a7ccc0f6 100644 --- a/cmd/integration/integration.go +++ b/cmd/integration/integration.go @@ -785,7 +785,7 @@ func runSchedulerNoPhantomPodsTest(client *client.Client) { Containers: []api.Container{ { Name: "c1", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: e2e.GetPauseImageName(client), Ports: []api.ContainerPort{ {ContainerPort: 1234, HostPort: 9999}, }, @@ -795,7 +795,7 @@ func runSchedulerNoPhantomPodsTest(client *client.Client) { }, } - // Assuming we only have two kublets, the third pod here won't schedule + // Assuming we only have two kubelets, the third pod here won't schedule // if the scheduler doesn't correctly handle the delete for the second // pod. pod.ObjectMeta.Name = "phantom.foo" diff --git a/cmd/kubelet/app/options/options.go b/cmd/kubelet/app/options/options.go index 31a681f4df..fa55257215 100644 --- a/cmd/kubelet/app/options/options.go +++ b/cmd/kubelet/app/options/options.go @@ -39,6 +39,7 @@ const ( defaultRootDir = "/var/lib/kubelet" experimentalFlannelOverlay = false + // When these values are updated, also update test/e2e/util.go defaultPodInfraContainerImageName = "gcr.io/google_containers/pause" defaultPodInfraContainerImageVersion = "3.0" ) diff --git a/examples/kubectl-container/Makefile b/examples/kubectl-container/Makefile index 3683432680..1f2fbed3cc 100644 --- a/examples/kubectl-container/Makefile +++ b/examples/kubectl-container/Makefile @@ -19,8 +19,11 @@ # `make container` will build a container-- you must supply a tag. # `make push` will push the container-- you must supply a tag. +GOARCH?=$(shell go env GOARCH) +GOOS?=$(shell go env GOOS) + kubectl: - KUBE_STATIC_OVERRIDES="kubectl" ../../hack/build-go.sh cmd/kubectl; cp ../../_output/local/bin/linux/amd64/kubectl . + KUBE_STATIC_OVERRIDES="kubectl" ../../hack/build-go.sh cmd/kubectl; cp ../../_output/local/bin/$(GOOS)/$(GOARCH)/kubectl . .tag: kubectl ./kubectl version -c | grep -o 'GitVersion:"[^"]*"' | cut -f 2 -d '"' > .tag diff --git a/test/component/scheduler/perf/util.go b/test/component/scheduler/perf/util.go index d3ad7f22f2..371baa3c83 100644 --- a/test/component/scheduler/perf/util.go +++ b/test/component/scheduler/perf/util.go @@ -32,6 +32,7 @@ import ( "k8s.io/kubernetes/plugin/pkg/scheduler" _ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider" "k8s.io/kubernetes/plugin/pkg/scheduler/factory" + e2e "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/integration/framework" ) @@ -113,7 +114,7 @@ func makePodSpec() api.PodSpec { return api.PodSpec{ Containers: []api.Container{{ Name: "pause", - Image: "gcr.io/google_containers/pause:1.0", + Image: e2e.GetPauseImageNameForHostArch(), Ports: []api.ContainerPort{{ContainerPort: 80}}, Resources: api.ResourceRequirements{ Limits: api.ResourceList{ diff --git a/test/e2e/cluster_size_autoscaling.go b/test/e2e/cluster_size_autoscaling.go index 1a1e0dd49e..550c91e4b4 100644 --- a/test/e2e/cluster_size_autoscaling.go +++ b/test/e2e/cluster_size_autoscaling.go @@ -86,7 +86,7 @@ func CreateHostPortPods(f *framework.Framework, id string, replicas int, expectR Name: id, Namespace: f.Namespace.Name, Timeout: scaleTimeout, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Replicas: replicas, HostPorts: map[string]int{"port1": 4321}, } @@ -105,7 +105,7 @@ func ReserveCpu(f *framework.Framework, id string, replicas, millicores int) { Name: id, Namespace: f.Namespace.Name, Timeout: scaleTimeout, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Replicas: replicas, CpuRequest: request, } @@ -120,7 +120,7 @@ func ReserveMemory(f *framework.Framework, id string, replicas, megabytes int, e Name: id, Namespace: f.Namespace.Name, Timeout: scaleTimeout, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Replicas: replicas, MemRequest: request, } diff --git a/test/e2e/daemon_restart.go b/test/e2e/daemon_restart.go index bbfc8a12e6..762d615755 100644 --- a/test/e2e/daemon_restart.go +++ b/test/e2e/daemon_restart.go @@ -209,7 +209,7 @@ var _ = framework.KubeDescribe("DaemonRestart [Disruptive]", func() { Client: f.Client, Name: rcName, Namespace: ns, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Replicas: numPods, CreatedPods: &[]*api.Pod{}, } diff --git a/test/e2e/density.go b/test/e2e/density.go index 093335c801..e48ed844e0 100644 --- a/test/e2e/density.go +++ b/test/e2e/density.go @@ -294,7 +294,7 @@ var _ = framework.KubeDescribe("Density", func() { for i := 0; i < numberOrRCs; i++ { RCName = "density" + strconv.Itoa(totalPods) + "-" + strconv.Itoa(i) + "-" + uuid RCConfigs[i] = framework.RCConfig{Client: c, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Name: RCName, Namespace: ns, Labels: map[string]string{"type": "densityPod"}, @@ -522,7 +522,7 @@ var _ = framework.KubeDescribe("Density", func() { } for i := 1; i <= nodeCount; i++ { name := additionalPodsPrefix + "-" + strconv.Itoa(i) - go createRunningPodFromRC(&wg, c, name, ns, "gcr.io/google_containers/pause-amd64:3.0", additionalPodsPrefix, cpuRequest, memRequest) + go createRunningPodFromRC(&wg, c, name, ns, framework.GetPauseImageName(f.Client), additionalPodsPrefix, cpuRequest, memRequest) time.Sleep(200 * time.Millisecond) } wg.Wait() diff --git a/test/e2e/etcd_failure.go b/test/e2e/etcd_failure.go index 8071c035d9..0fb6a0c66e 100644 --- a/test/e2e/etcd_failure.go +++ b/test/e2e/etcd_failure.go @@ -44,7 +44,7 @@ var _ = framework.KubeDescribe("Etcd failure [Disruptive]", func() { Client: f.Client, Name: "baz", Namespace: f.Namespace.Name, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Replicas: 1, })).NotTo(HaveOccurred()) }) diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 85da3f2610..7d10313006 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -30,6 +30,7 @@ import ( "os/exec" "path" "path/filepath" + goRuntime "runtime" "sort" "strconv" "strings" @@ -128,12 +129,42 @@ const ( // How long claims have to become dynamically provisioned ClaimProvisionTimeout = 5 * time.Minute + + // When these values are updated, also update cmd/kubelet/app/options/options.go + currentPodInfraContainerImageName = "gcr.io/google_containers/pause" + currentPodInfraContainerImageVersion = "3.0" ) // Label allocated to the image puller static pod that runs on each node // before e2es. var ImagePullerLabels = map[string]string{"name": "e2e-image-puller"} +// GetServerArchitecture fetches the architecture of the target cluster. +func GetServerArchitecture(c *client.Client) string { + arch := "" + sVer, err := c.Discovery().ServerVersion() + if err != nil || sVer.Platform == "" { + // If we failed to get the server version for some reason, default to amd64. + arch = "amd64" + } else { + // Split the platform string into OS and Arch separately. + // The platform string may for example be "linux/amd64", "linux/arm" or "windows/amd64". + osArchArray := strings.Split(sVer.Platform, "/") + arch = osArchArray[1] + } + return arch +} + +// GetPauseImageName fetches the architecture of the target cluster and chooses the pause image to use. +func GetPauseImageName(c *client.Client) string { + return currentPodInfraContainerImageName + "-" + GetServerArchitecture(c) + ":" + currentPodInfraContainerImageVersion +} + +// GetPauseImageNameForHostArch() fetches the pause image for the same architecture the machine is running on. +func GetPauseImageNameForHostArch() string { + return currentPodInfraContainerImageName + "-" + goRuntime.GOARCH + ":" + currentPodInfraContainerImageVersion +} + // SubResource proxy should have been functional in v1.0.0, but SubResource // proxy via tunneling is known to be broken in v1.0. See // https://github.com/kubernetes/kubernetes/pull/15224#issuecomment-146769463 diff --git a/test/e2e/kubectl.go b/test/e2e/kubectl.go index 779344fae1..7601fc0ee0 100644 --- a/test/e2e/kubectl.go +++ b/test/e2e/kubectl.go @@ -1429,37 +1429,6 @@ func streamingUpload(file *os.File, fileName string, postBodyWriter *multipart.W } } -var binPrefixes = []string{ - "_output/dockerized/bin", - "_output/local/bin", - "platforms", -} - -// findBinary searches through likely paths to find the specified binary. It -// takes the one that has been built most recently. Platform should be -// specified as '/'. For example: 'linux/amd64'. -func findBinary(binName string, platform string) (string, error) { - var binTime time.Time - var binPath string - - for _, pre := range binPrefixes { - tryPath := path.Join(framework.TestContext.RepoRoot, pre, platform, binName) - fi, err := os.Stat(tryPath) - if err != nil { - continue - } - if fi.ModTime().After(binTime) { - binPath = tryPath - binTime = fi.ModTime() - } - } - - if len(binPath) > 0 { - return binPath, nil - } - return binPath, fmt.Errorf("Could not find %v for %v", binName, platform) -} - func startLocalProxy() (srv *httptest.Server, logs *bytes.Buffer) { logs = &bytes.Buffer{} p := goproxy.NewProxyHttpServer() diff --git a/test/e2e/kubelet.go b/test/e2e/kubelet.go index 29f8d68046..3b504b2ef2 100644 --- a/test/e2e/kubelet.go +++ b/test/e2e/kubelet.go @@ -128,7 +128,7 @@ var _ = framework.KubeDescribe("kubelet", func() { Client: f.Client, Name: rcName, Namespace: f.Namespace.Name, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Replicas: totalPods, })).NotTo(HaveOccurred()) // Perform a sanity check so that we know all desired pods are diff --git a/test/e2e/kubelet_perf.go b/test/e2e/kubelet_perf.go index fab4d25b9d..f8f87246e4 100644 --- a/test/e2e/kubelet_perf.go +++ b/test/e2e/kubelet_perf.go @@ -69,7 +69,7 @@ func runResourceTrackingTest(f *framework.Framework, podsPerNode int, nodeNames Client: f.Client, Name: rcName, Namespace: f.Namespace.Name, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Replicas: totalPods, })).NotTo(HaveOccurred()) diff --git a/test/e2e/limit_range.go b/test/e2e/limit_range.go index 5e18c525b5..11cfd0c8c9 100644 --- a/test/e2e/limit_range.go +++ b/test/e2e/limit_range.go @@ -53,7 +53,7 @@ var _ = framework.KubeDescribe("LimitRange", func() { Expect(err).NotTo(HaveOccurred()) By("Creating a Pod with no resource requirements") - pod := newTestPod("pod-no-resources", api.ResourceList{}, api.ResourceList{}) + pod := newTestPod(f, "pod-no-resources", api.ResourceList{}, api.ResourceList{}) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).NotTo(HaveOccurred()) @@ -70,7 +70,7 @@ var _ = framework.KubeDescribe("LimitRange", func() { } By("Creating a Pod with partial resource requirements") - pod = newTestPod("pod-partial-resources", getResourceList("", "150Mi"), getResourceList("300m", "")) + pod = newTestPod(f, "pod-partial-resources", getResourceList("", "150Mi"), getResourceList("300m", "")) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).NotTo(HaveOccurred()) @@ -91,12 +91,12 @@ var _ = framework.KubeDescribe("LimitRange", func() { } By("Failing to create a Pod with less than min resources") - pod = newTestPod(podName, getResourceList("10m", "50Mi"), api.ResourceList{}) + pod = newTestPod(f, podName, getResourceList("10m", "50Mi"), api.ResourceList{}) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).To(HaveOccurred()) By("Failing to create a Pod with more than max resources") - pod = newTestPod(podName, getResourceList("600m", "600Mi"), api.ResourceList{}) + pod = newTestPod(f, podName, getResourceList("600m", "600Mi"), api.ResourceList{}) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).To(HaveOccurred()) }) @@ -167,7 +167,7 @@ func newLimitRange(name string, limitType api.LimitType, } // newTestPod returns a pod that has the specified requests and limits -func newTestPod(name string, requests api.ResourceList, limits api.ResourceList) *api.Pod { +func newTestPod(f *framework.Framework, name string, requests api.ResourceList, limits api.ResourceList) *api.Pod { return &api.Pod{ ObjectMeta: api.ObjectMeta{ Name: name, @@ -175,8 +175,8 @@ func newTestPod(name string, requests api.ResourceList, limits api.ResourceList) Spec: api.PodSpec{ Containers: []api.Container{ { - Name: "nginx", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Name: "pause", + Image: framework.GetPauseImageName(f.Client), Resources: api.ResourceRequirements{ Requests: requests, Limits: limits, diff --git a/test/e2e/mesos.go b/test/e2e/mesos.go index a156f14306..239c7604fd 100644 --- a/test/e2e/mesos.go +++ b/test/e2e/mesos.go @@ -94,7 +94,7 @@ var _ = framework.KubeDescribe("Mesos", func() { Containers: []api.Container{ { Name: podName, - Image: "beta.gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, diff --git a/test/e2e/namespace.go b/test/e2e/namespace.go index 297f4a1977..44b5f290a8 100644 --- a/test/e2e/namespace.go +++ b/test/e2e/namespace.go @@ -97,7 +97,7 @@ func ensurePodsAreRemovedWhenNamespaceIsDeleted(f *framework.Framework) { Containers: []api.Container{ { Name: "nginx", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, diff --git a/test/e2e/nodeoutofdisk.go b/test/e2e/nodeoutofdisk.go index 41421eeb9a..c700d7c024 100644 --- a/test/e2e/nodeoutofdisk.go +++ b/test/e2e/nodeoutofdisk.go @@ -179,7 +179,7 @@ func createOutOfDiskPod(c *client.Client, ns, name string, milliCPU int64) { Containers: []api.Container{ { Name: "pause", - Image: "beta.gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(c), Resources: api.ResourceRequirements{ Requests: api.ResourceList{ // Request enough CPU to fit only two pods on a given node. diff --git a/test/e2e/pods.go b/test/e2e/pods.go index da3d0821e4..8bd1f9920e 100644 --- a/test/e2e/pods.go +++ b/test/e2e/pods.go @@ -219,7 +219,7 @@ var _ = framework.KubeDescribe("Pods", func() { Containers: []api.Container{ { Name: "test", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -244,7 +244,7 @@ var _ = framework.KubeDescribe("Pods", func() { Containers: []api.Container{ { Name: "nginx", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Resources: api.ResourceRequirements{ Limits: api.ResourceList{ api.ResourceCPU: *resource.NewMilliQuantity(100, resource.DecimalSI), @@ -754,7 +754,7 @@ var _ = framework.KubeDescribe("Pods", func() { Containers: []api.Container{ { Name: "run1", - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), Resources: api.ResourceRequirements{ Limits: api.ResourceList{ api.ResourceCPU: *resource.NewMilliQuantity(100, resource.DecimalSI), @@ -823,7 +823,7 @@ var _ = framework.KubeDescribe("Pods", func() { Containers: []api.Container{ { Name: "run1", - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), Resources: api.ResourceRequirements{ Limits: api.ResourceList{ api.ResourceCPU: *resource.NewMilliQuantity(100, resource.DecimalSI), diff --git a/test/e2e/resource_quota.go b/test/e2e/resource_quota.go index 9844dc1846..f75f7492dc 100644 --- a/test/e2e/resource_quota.go +++ b/test/e2e/resource_quota.go @@ -328,7 +328,7 @@ var _ = framework.KubeDescribe("ResourceQuota", func() { requests := api.ResourceList{} requests[api.ResourceCPU] = resource.MustParse("500m") requests[api.ResourceMemory] = resource.MustParse("252Mi") - pod := newTestPodForQuota(podName, requests, api.ResourceList{}) + pod := newTestPodForQuota(f, podName, requests, api.ResourceList{}) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).NotTo(HaveOccurred()) podToUpdate := pod @@ -345,7 +345,7 @@ var _ = framework.KubeDescribe("ResourceQuota", func() { requests = api.ResourceList{} requests[api.ResourceCPU] = resource.MustParse("600m") requests[api.ResourceMemory] = resource.MustParse("100Mi") - pod = newTestPodForQuota("fail-pod", requests, api.ResourceList{}) + pod = newTestPodForQuota(f, "fail-pod", requests, api.ResourceList{}) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).To(HaveOccurred()) @@ -509,7 +509,7 @@ var _ = framework.KubeDescribe("ResourceQuota", func() { limits := api.ResourceList{} limits[api.ResourceCPU] = resource.MustParse("1") limits[api.ResourceMemory] = resource.MustParse("400Mi") - pod := newTestPodForQuota(podName, requests, limits) + pod := newTestPodForQuota(f, podName, requests, limits) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).NotTo(HaveOccurred()) @@ -546,7 +546,7 @@ var _ = framework.KubeDescribe("ResourceQuota", func() { By("Creating a terminating pod") podName = "terminating-pod" - pod = newTestPodForQuota(podName, requests, limits) + pod = newTestPodForQuota(f, podName, requests, limits) activeDeadlineSeconds := int64(3600) pod.Spec.ActiveDeadlineSeconds = &activeDeadlineSeconds pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) @@ -604,7 +604,7 @@ var _ = framework.KubeDescribe("ResourceQuota", func() { Expect(err).NotTo(HaveOccurred()) By("Creating a best-effort pod") - pod := newTestPodForQuota(podName, api.ResourceList{}, api.ResourceList{}) + pod := newTestPodForQuota(f, podName, api.ResourceList{}, api.ResourceList{}) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).NotTo(HaveOccurred()) @@ -634,7 +634,7 @@ var _ = framework.KubeDescribe("ResourceQuota", func() { limits := api.ResourceList{} limits[api.ResourceCPU] = resource.MustParse("1") limits[api.ResourceMemory] = resource.MustParse("400Mi") - pod = newTestPodForQuota("burstable-pod", requests, limits) + pod = newTestPodForQuota(f, "burstable-pod", requests, limits) pod, err = f.Client.Pods(f.Namespace.Name).Create(pod) Expect(err).NotTo(HaveOccurred()) @@ -697,7 +697,7 @@ func newTestResourceQuota(name string) *api.ResourceQuota { } // newTestPodForQuota returns a pod that has the specified requests and limits -func newTestPodForQuota(name string, requests api.ResourceList, limits api.ResourceList) *api.Pod { +func newTestPodForQuota(f *framework.Framework, name string, requests api.ResourceList, limits api.ResourceList) *api.Pod { return &api.Pod{ ObjectMeta: api.ObjectMeta{ Name: name, @@ -705,8 +705,8 @@ func newTestPodForQuota(name string, requests api.ResourceList, limits api.Resou Spec: api.PodSpec{ Containers: []api.Container{ { - Name: "nginx", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Name: "pause", + Image: framework.GetPauseImageName(f.Client), Resources: api.ResourceRequirements{ Requests: requests, Limits: limits, diff --git a/test/e2e/scheduler_predicates.go b/test/e2e/scheduler_predicates.go index e1a41c7ecd..bd48bb35c3 100644 --- a/test/e2e/scheduler_predicates.go +++ b/test/e2e/scheduler_predicates.go @@ -238,7 +238,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: "", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -257,7 +257,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -315,7 +315,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: "", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Resources: api.ResourceRequirements{ Limits: api.ResourceList{ "cpu": *resource.NewMilliQuantity(milliCpuPerPod, "DecimalSI"), @@ -342,7 +342,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Resources: api.ResourceRequirements{ Limits: api.ResourceList{ "cpu": *resource.NewMilliQuantity(milliCpuPerPod, "DecimalSI"), @@ -382,7 +382,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, NodeSelector: map[string]string{ @@ -425,7 +425,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -461,7 +461,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -499,7 +499,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: labelPodName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, NodeSelector: map[string]string{ @@ -563,7 +563,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -598,7 +598,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -654,7 +654,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: labelPodName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -692,7 +692,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -771,7 +771,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -822,7 +822,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -857,7 +857,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -910,7 +910,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: labelPodName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -949,7 +949,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1002,7 +1002,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: labelPodName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1037,7 +1037,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1098,7 +1098,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: labelPodName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1137,7 +1137,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1201,7 +1201,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: labelPodName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1240,7 +1240,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause:2.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1304,7 +1304,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1369,7 +1369,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: tolerationPodName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1426,7 +1426,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podName, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, @@ -1481,7 +1481,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() { Containers: []api.Container{ { Name: podNameNoTolerations, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, diff --git a/test/e2e/service.go b/test/e2e/service.go index 93fd427a35..a87d4e75dd 100644 --- a/test/e2e/service.go +++ b/test/e2e/service.go @@ -1138,8 +1138,8 @@ func createPodOrFail(c *client.Client, ns, name string, labels map[string]string Spec: api.PodSpec{ Containers: []api.Container{ { - Name: "test", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Name: "pause", + Image: framework.GetPauseImageName(c), Ports: containerPorts, // Add a dummy environment variable to work around a docker issue. // https://github.com/docker/docker/issues/14203 diff --git a/test/e2e/service_latency.go b/test/e2e/service_latency.go index a88dfa2750..e309a33a96 100644 --- a/test/e2e/service_latency.go +++ b/test/e2e/service_latency.go @@ -118,7 +118,7 @@ var _ = framework.KubeDescribe("Service endpoints latency", func() { func runServiceLatencies(f *framework.Framework, inParallel, total int) (output []time.Duration, err error) { cfg := framework.RCConfig{ Client: f.Client, - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), Name: "svc-latency-rc", Namespace: f.Namespace.Name, Replicas: 1, diff --git a/test/e2e/ubernetes_lite.go b/test/e2e/ubernetes_lite.go index 52aaa9fe1b..c3368c7970 100644 --- a/test/e2e/ubernetes_lite.go +++ b/test/e2e/ubernetes_lite.go @@ -88,7 +88,7 @@ func SpreadServiceOrFail(f *framework.Framework, replicaCount int, image string) Containers: []api.Container{ { Name: "test", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: framework.GetPauseImageName(f.Client), }, }, }, diff --git a/test/e2e_node/container_list.go b/test/e2e_node/container_list.go index 1afd213043..91b4f27920 100644 --- a/test/e2e_node/container_list.go +++ b/test/e2e_node/container_list.go @@ -21,6 +21,8 @@ import ( "time" "github.com/golang/glog" + + "k8s.io/kubernetes/test/e2e/framework" ) const ( @@ -45,7 +47,7 @@ var ImageRegistry = map[int]string{ hostExecImage: "gcr.io/google_containers/hostexec:1.2", netExecImage: "gcr.io/google_containers/netexec:1.4", nginxImage: "gcr.io/google_containers/nginx:1.7.9", - pauseImage: "gcr.io/google_containers/pause-amd64:3.0", + pauseImage: framework.GetPauseImageNameForHostArch(), } // These are used by tests that explicitly test the ability to pull images diff --git a/test/integration/client_test.go b/test/integration/client_test.go index d459ccb343..58c1bfed19 100644 --- a/test/integration/client_test.go +++ b/test/integration/client_test.go @@ -35,6 +35,7 @@ import ( "k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/version" "k8s.io/kubernetes/pkg/watch" + e2e "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/integration/framework" ) @@ -234,8 +235,8 @@ func TestMultiWatch(t *testing.T) { }, Spec: api.PodSpec{ Containers: []api.Container{{ - Name: "nothing", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Name: "pause", + Image: e2e.GetPauseImageName(client), }}, }, }) @@ -341,7 +342,7 @@ func TestMultiWatch(t *testing.T) { Spec: api.PodSpec{ Containers: []api.Container{{ Name: "nothing", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: e2e.GetPauseImageName(client), }}, }, }) @@ -372,7 +373,7 @@ func TestMultiWatch(t *testing.T) { if err != nil { panic(fmt.Sprintf("Couldn't get %v: %v", name, err)) } - pod.Spec.Containers[0].Image = "gcr.io/google_containers/pause-amd64:3.0" + pod.Spec.Containers[0].Image = e2e.GetPauseImageName(client) sentTimes <- timePair{time.Now(), name} if _, err := client.Pods(ns).Update(pod); err != nil { panic(fmt.Sprintf("Couldn't make %v: %v", name, err)) diff --git a/test/integration/extender_test.go b/test/integration/extender_test.go index 30a8f085d8..61c2173a64 100644 --- a/test/integration/extender_test.go +++ b/test/integration/extender_test.go @@ -42,6 +42,7 @@ import ( _ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider" schedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api" "k8s.io/kubernetes/plugin/pkg/scheduler/factory" + e2e "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/integration/framework" ) @@ -283,7 +284,7 @@ func DoTestPodScheduling(t *testing.T, restClient *client.Client) { pod := &api.Pod{ ObjectMeta: api.ObjectMeta{Name: "extender-test-pod"}, Spec: api.PodSpec{ - Containers: []api.Container{{Name: "container", Image: "gcr.io/google_containers/pause-amd64:3.0"}}, + Containers: []api.Container{{Name: "container", Image: e2e.GetPauseImageName(restClient)}}, }, } diff --git a/test/integration/scheduler_test.go b/test/integration/scheduler_test.go index 73c36a9a2a..1daee74117 100644 --- a/test/integration/scheduler_test.go +++ b/test/integration/scheduler_test.go @@ -41,6 +41,7 @@ import ( "k8s.io/kubernetes/plugin/pkg/scheduler" _ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider" "k8s.io/kubernetes/plugin/pkg/scheduler/factory" + e2e "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/integration/framework" ) @@ -232,7 +233,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore pod := &api.Pod{ ObjectMeta: api.ObjectMeta{Name: "node-scheduling-test-pod"}, Spec: api.PodSpec{ - Containers: []api.Container{{Name: "container", Image: "gcr.io/google_containers/pause-amd64:3.0"}}, + Containers: []api.Container{{Name: "container", Image: e2e.GetPauseImageName(restClient)}}, }, } myPod, err := restClient.Pods(api.NamespaceDefault).Create(pod) @@ -339,21 +340,21 @@ func TestMultiScheduler(t *testing.T) { restClient.Nodes().Create(node) // 3. create 3 pods for testing - podWithNoAnnotation := createPod("pod-with-no-annotation", nil) + podWithNoAnnotation := createPod(restClient, "pod-with-no-annotation", nil) testPodNoAnnotation, err := restClient.Pods(api.NamespaceDefault).Create(podWithNoAnnotation) if err != nil { t.Fatalf("Failed to create pod: %v", err) } schedulerAnnotationFitsDefault := map[string]string{"scheduler.alpha.kubernetes.io/name": "default-scheduler"} - podWithAnnotationFitsDefault := createPod("pod-with-annotation-fits-default", schedulerAnnotationFitsDefault) + podWithAnnotationFitsDefault := createPod(restClient, "pod-with-annotation-fits-default", schedulerAnnotationFitsDefault) testPodWithAnnotationFitsDefault, err := restClient.Pods(api.NamespaceDefault).Create(podWithAnnotationFitsDefault) if err != nil { t.Fatalf("Failed to create pod: %v", err) } schedulerAnnotationFitsFoo := map[string]string{"scheduler.alpha.kubernetes.io/name": "foo-scheduler"} - podWithAnnotationFitsFoo := createPod("pod-with-annotation-fits-foo", schedulerAnnotationFitsFoo) + podWithAnnotationFitsFoo := createPod(restClient, "pod-with-annotation-fits-foo", schedulerAnnotationFitsFoo) testPodWithAnnotationFitsFoo, err := restClient.Pods(api.NamespaceDefault).Create(podWithAnnotationFitsFoo) if err != nil { t.Fatalf("Failed to create pod: %v", err) @@ -456,11 +457,11 @@ func TestMultiScheduler(t *testing.T) { */ } -func createPod(name string, annotation map[string]string) *api.Pod { +func createPod(client *client.Client, name string, annotation map[string]string) *api.Pod { return &api.Pod{ ObjectMeta: api.ObjectMeta{Name: name, Annotations: annotation}, Spec: api.PodSpec{ - Containers: []api.Container{{Name: "container", Image: "gcr.io/google_containers/pause-amd64:3.0"}}, + Containers: []api.Container{{Name: "container", Image: e2e.GetPauseImageName(client)}}, }, } } @@ -521,7 +522,7 @@ func TestAllocatable(t *testing.T) { Containers: []api.Container{ { Name: "container", - Image: "gcr.io/google_containers/pause-amd64:3.0", + Image: e2e.GetPauseImageName(restClient), Resources: api.ResourceRequirements{ Requests: api.ResourceList{ api.ResourceCPU: *resource.NewMilliQuantity(20, resource.DecimalSI),