tests: Replaces images used with agnhost (part 3)

Quite a few images are only used a few times in a few tests. Thus,
the images are being centralized into the agnhost image, reducing
the number of images that have to be pulled and used.

This PR replaces the usage of the following images with agnhost:

- audit-proxy
- crd-conversion-webhook
- entrypoint-tester
- inclusterclient
- iperf
- porter
- serve-hostname
This commit is contained in:
Claudiu Belu
2019-05-20 19:40:25 -07:00
parent a78ae4ba74
commit c752ea8134
22 changed files with 74 additions and 75 deletions

View File

@@ -266,7 +266,7 @@ func testRollingUpdateDeployment(f *framework.Framework) {
rsRevision := "3546343826724305832"
annotations := make(map[string]string)
annotations[deploymentutil.RevisionAnnotation] = rsRevision
rs := newRS(rsName, replicas, rsPodLabels, WebserverImageName, WebserverImage)
rs := newRS(rsName, replicas, rsPodLabels, WebserverImageName, WebserverImage, nil)
rs.Annotations = annotations
e2elog.Logf("Creating replica set %q (going to be adopted)", rs.Name)
_, err := c.AppsV1().ReplicaSets(ns).Create(rs)
@@ -346,7 +346,7 @@ func testDeploymentCleanUpPolicy(f *framework.Framework) {
rsName := "test-cleanup-controller"
replicas := int32(1)
revisionHistoryLimit := utilpointer.Int32Ptr(0)
_, err := c.AppsV1().ReplicaSets(ns).Create(newRS(rsName, replicas, rsPodLabels, WebserverImageName, WebserverImage))
_, err := c.AppsV1().ReplicaSets(ns).Create(newRS(rsName, replicas, rsPodLabels, WebserverImageName, WebserverImage, nil))
framework.ExpectNoError(err)
// Verify that the required pods have come up.
@@ -417,7 +417,7 @@ func testRolloverDeployment(f *framework.Framework) {
rsName := "test-rollover-controller"
rsReplicas := int32(1)
_, err := c.AppsV1().ReplicaSets(ns).Create(newRS(rsName, rsReplicas, rsPodLabels, WebserverImageName, WebserverImage))
_, err := c.AppsV1().ReplicaSets(ns).Create(newRS(rsName, rsReplicas, rsPodLabels, WebserverImageName, WebserverImage, nil))
framework.ExpectNoError(err)
// Verify that the required pods have come up.
err = e2epod.VerifyPodsRunning(c, ns, podName, false, rsReplicas)

View File

@@ -87,6 +87,7 @@ func podOnNode(podName, nodeName string, image string) *v1.Pod {
{
Name: podName,
Image: image,
Args: []string{"serve-hostname"},
Ports: []v1.ContainerPort{{ContainerPort: 9376}},
},
},

View File

@@ -52,7 +52,7 @@ var _ = SIGDescribe("ReplicationController", func() {
ginkgo.It("should serve a basic image on each replica with a private image", func() {
// requires private images
framework.SkipUnlessProviderIs("gce", "gke")
privateimage := imageutils.GetConfig(imageutils.ServeHostname)
privateimage := imageutils.GetConfig(imageutils.Agnhost)
privateimage.SetRegistry(imageutils.PrivateRegistry)
TestReplicationControllerServeImageOrFail(f, "private", privateimage.GetE2EImage())
})
@@ -85,7 +85,7 @@ var _ = SIGDescribe("ReplicationController", func() {
})
})
func newRC(rsName string, replicas int32, rcPodLabels map[string]string, imageName string, image string) *v1.ReplicationController {
func newRC(rsName string, replicas int32, rcPodLabels map[string]string, imageName string, image string, args []string) *v1.ReplicationController {
zero := int64(0)
return &v1.ReplicationController{
ObjectMeta: metav1.ObjectMeta{
@@ -103,6 +103,7 @@ func newRC(rsName string, replicas int32, rcPodLabels map[string]string, imageNa
{
Name: imageName,
Image: image,
Args: args,
},
},
},
@@ -123,7 +124,7 @@ func TestReplicationControllerServeImageOrFail(f *framework.Framework, test stri
// The source for the Docker container kubernetes/serve_hostname is
// in contrib/for-demos/serve_hostname
ginkgo.By(fmt.Sprintf("Creating replication controller %s", name))
newRC := newRC(name, replicas, map[string]string{"name": name}, name, image)
newRC := newRC(name, replicas, map[string]string{"name": name}, name, image, []string{"serve-hostname"})
newRC.Spec.Template.Spec.Containers[0].Ports = []v1.ContainerPort{{ContainerPort: 9376}}
_, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(newRC)
framework.ExpectNoError(err)
@@ -200,7 +201,7 @@ func testReplicationControllerConditionCheck(f *framework.Framework) {
framework.ExpectNoError(err)
ginkgo.By(fmt.Sprintf("Creating rc %q that asks for more than the allowed pod quota", name))
rc := newRC(name, 3, map[string]string{"name": name}, WebserverImageName, WebserverImage)
rc := newRC(name, 3, map[string]string{"name": name}, WebserverImageName, WebserverImage, nil)
rc, err = c.CoreV1().ReplicationControllers(namespace).Create(rc)
framework.ExpectNoError(err)
@@ -278,7 +279,7 @@ func testRCAdoptMatchingOrphans(f *framework.Framework) {
ginkgo.By("When a replication controller with a matching selector is created")
replicas := int32(1)
rcSt := newRC(name, replicas, map[string]string{"name": name}, name, WebserverImage)
rcSt := newRC(name, replicas, map[string]string{"name": name}, name, WebserverImage, nil)
rcSt.Spec.Selector = map[string]string{"name": name}
rc, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(rcSt)
framework.ExpectNoError(err)
@@ -307,7 +308,7 @@ func testRCReleaseControlledNotMatching(f *framework.Framework) {
name := "pod-release"
ginkgo.By("Given a ReplicationController is created")
replicas := int32(1)
rcSt := newRC(name, replicas, map[string]string{"name": name}, name, WebserverImage)
rcSt := newRC(name, replicas, map[string]string{"name": name}, name, WebserverImage, nil)
rcSt.Spec.Selector = map[string]string{"name": name}
rc, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(rcSt)
framework.ExpectNoError(err)

View File

@@ -38,7 +38,7 @@ import (
imageutils "k8s.io/kubernetes/test/utils/image"
)
func newRS(rsName string, replicas int32, rsPodLabels map[string]string, imageName string, image string) *appsv1.ReplicaSet {
func newRS(rsName string, replicas int32, rsPodLabels map[string]string, imageName string, image string, args []string) *appsv1.ReplicaSet {
zero := int64(0)
return &appsv1.ReplicaSet{
ObjectMeta: metav1.ObjectMeta{
@@ -60,6 +60,7 @@ func newRS(rsName string, replicas int32, rsPodLabels map[string]string, imageNa
{
Name: imageName,
Image: image,
Args: args,
},
},
},
@@ -96,7 +97,7 @@ var _ = SIGDescribe("ReplicaSet", func() {
ginkgo.It("should serve a basic image on each replica with a private image", func() {
// requires private images
framework.SkipUnlessProviderIs("gce", "gke")
privateimage := imageutils.GetConfig(imageutils.ServeHostname)
privateimage := imageutils.GetConfig(imageutils.Agnhost)
privateimage.SetRegistry(imageutils.PrivateRegistry)
testReplicaSetServeImageOrFail(f, "private", privateimage.GetE2EImage())
})
@@ -125,7 +126,7 @@ func testReplicaSetServeImageOrFail(f *framework.Framework, test string, image s
// The source for the Docker containter kubernetes/serve_hostname is
// in contrib/for-demos/serve_hostname
e2elog.Logf("Creating ReplicaSet %s", name)
newRS := newRS(name, replicas, map[string]string{"name": name}, name, image)
newRS := newRS(name, replicas, map[string]string{"name": name}, name, image, []string{"serve-hostname"})
newRS.Spec.Template.Spec.Containers[0].Ports = []v1.ContainerPort{{ContainerPort: 9376}}
_, err := f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).Create(newRS)
framework.ExpectNoError(err)
@@ -202,7 +203,7 @@ func testReplicaSetConditionCheck(f *framework.Framework) {
framework.ExpectNoError(err)
ginkgo.By(fmt.Sprintf("Creating replica set %q that asks for more than the allowed pod quota", name))
rs := newRS(name, 3, map[string]string{"name": name}, WebserverImageName, WebserverImage)
rs := newRS(name, 3, map[string]string{"name": name}, WebserverImageName, WebserverImage, nil)
rs, err = c.AppsV1().ReplicaSets(namespace).Create(rs)
framework.ExpectNoError(err)
@@ -281,7 +282,7 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) {
ginkgo.By("When a replicaset with a matching selector is created")
replicas := int32(1)
rsSt := newRS(name, replicas, map[string]string{"name": name}, name, WebserverImage)
rsSt := newRS(name, replicas, map[string]string{"name": name}, name, WebserverImage, nil)
rsSt.Spec.Selector = &metav1.LabelSelector{MatchLabels: map[string]string{"name": name}}
rs, err := f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).Create(rsSt)
framework.ExpectNoError(err)