mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
Merge pull request #25972 from luxas/remove_arch_constants
Automatic merge from submit-queue Use pause image depending on the server's platform when testing Removed all pause image constant strings, now the pause image is chosen by arch. Part of the effort of making e2e arch-agnostic. The pause image name and version is also now only in two places, and it's documented to bump both Also removed "amd64" constants in the code. Such constants should be replaced by `runtime.GOARCH` or by looking up the server platform Fixes: #22876 and #15140 Makes it easier for: #25730 Related: #17981 This is for `v1.3` @ixdy @thockin @vishh @kubernetes/sig-testing @andyzheng0831 @pensu
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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)}},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user