From 9e81f3b50b80a3e79d4ffbf8bf0b46d998b2ced2 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Mon, 20 May 2019 19:40:25 -0700 Subject: [PATCH] tests: Replaces images used with agnhost (part 2) 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: - net - netexec - nettest - webhook --- test/e2e/apimachinery/webhook.go | 4 ++-- test/e2e/common/kubelet_etc_hosts.go | 2 +- test/e2e/common/lifecycle_hook.go | 3 ++- test/e2e/common/util.go | 2 -- test/e2e/framework/networking_utils.go | 10 +++++----- test/e2e/framework/service_util.go | 8 ++++---- test/e2e/framework/util.go | 2 +- test/e2e/framework/volume/fixtures.go | 4 ++-- test/e2e/kubectl/portforward.go | 3 ++- test/e2e/network/kube_proxy.go | 14 +++++++------- test/e2e/network/service.go | 4 ++-- test/e2e/node/pre_stop.go | 3 ++- test/e2e_node/image_list.go | 1 - test/utils/image/manifest.go | 14 +------------- 14 files changed, 31 insertions(+), 43 deletions(-) diff --git a/test/e2e/apimachinery/webhook.go b/test/e2e/apimachinery/webhook.go index 31f7ac3e75c..bfb32134385 100644 --- a/test/e2e/apimachinery/webhook.go +++ b/test/e2e/apimachinery/webhook.go @@ -118,7 +118,7 @@ var _ = SIGDescribe("AdmissionWebhook", func() { // Note that in 1.9 we will have backwards incompatible change to // admission webhooks, so the image will be updated to 1.9 sometime in // the development 1.9 cycle. - deployWebhookAndService(f, imageutils.GetE2EImage(imageutils.AdmissionWebhook), context) + deployWebhookAndService(f, imageutils.GetE2EImage(imageutils.Agnhost), context) }) ginkgo.AfterEach(func() { @@ -342,11 +342,11 @@ func deployWebhookAndService(f *framework.Framework, image string, context *cert Name: "sample-webhook", VolumeMounts: mounts, Args: []string{ + "webhook", "--tls-cert-file=/webhook.local.config/certificates/tls.crt", "--tls-private-key-file=/webhook.local.config/certificates/tls.key", "--alsologtostderr", "-v=4", - "2>&1", }, Image: image, }, diff --git a/test/e2e/common/kubelet_etc_hosts.go b/test/e2e/common/kubelet_etc_hosts.go index 08798823b0a..3c3b67c9cfa 100644 --- a/test/e2e/common/kubelet_etc_hosts.go +++ b/test/e2e/common/kubelet_etc_hosts.go @@ -36,7 +36,7 @@ const ( etcHostsOriginalPath = "/etc/hosts-original" ) -var etcHostsImageName = imageutils.GetE2EImage(imageutils.Netexec) +var etcHostsImageName = imageutils.GetE2EImage(imageutils.Agnhost) type KubeletManagedHostConfig struct { hostNetworkPod *v1.Pod diff --git a/test/e2e/common/lifecycle_hook.go b/test/e2e/common/lifecycle_hook.go index 6b4dbcf0cb0..070bf18ce63 100644 --- a/test/e2e/common/lifecycle_hook.go +++ b/test/e2e/common/lifecycle_hook.go @@ -49,7 +49,8 @@ var _ = framework.KubeDescribe("Container Lifecycle Hook", func() { Containers: []v1.Container{ { Name: "pod-handle-http-request", - Image: imageutils.GetE2EImage(imageutils.Netexec), + Image: imageutils.GetE2EImage(imageutils.Agnhost), + Args: []string{"netexec"}, Ports: []v1.ContainerPort{ { ContainerPort: 8080, diff --git a/test/e2e/common/util.go b/test/e2e/common/util.go index b8b9a4484eb..9dadaeee0d6 100644 --- a/test/e2e/common/util.go +++ b/test/e2e/common/util.go @@ -55,13 +55,11 @@ var CommonImageWhiteList = sets.NewString( imageutils.GetE2EImage(imageutils.IpcUtils), imageutils.GetE2EImage(imageutils.Mounttest), imageutils.GetE2EImage(imageutils.MounttestUser), - imageutils.GetE2EImage(imageutils.Netexec), imageutils.GetE2EImage(imageutils.Nginx), imageutils.GetE2EImage(imageutils.ServeHostname), imageutils.GetE2EImage(imageutils.TestWebserver), imageutils.GetE2EImage(imageutils.VolumeNFSServer), imageutils.GetE2EImage(imageutils.VolumeGlusterServer), - imageutils.GetE2EImage(imageutils.Net), ) type testImagesStruct struct { diff --git a/test/e2e/framework/networking_utils.go b/test/e2e/framework/networking_utils.go index ab2fcb6d75f..d8296527154 100644 --- a/test/e2e/framework/networking_utils.go +++ b/test/e2e/framework/networking_utils.go @@ -73,7 +73,7 @@ const ( RegexIPv6 = "(?:(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-fA-F]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,1}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,2}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,3}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:[0-9a-fA-F]{1,4})):)(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,4}(?:(?:[0-9a-fA-F]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,5}(?:(?:[0-9a-fA-F]{1,4})))?::)(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,6}(?:(?:[0-9a-fA-F]{1,4})))?::))))" ) -var netexecImageName = imageutils.GetE2EImage(imageutils.Netexec) +var netexecImageName = imageutils.GetE2EImage(imageutils.Agnhost) // NewNetworkingTestConfig creates and sets up a new test config helper. func NewNetworkingTestConfig(f *Framework) *NetworkingTestConfig { @@ -426,8 +426,8 @@ func (config *NetworkingTestConfig) createNetShellPodSpec(podName, hostname stri Name: "webserver", Image: netexecImageName, ImagePullPolicy: v1.PullIfNotPresent, - Command: []string{ - "/netexec", + Args: []string{ + "netexec", fmt.Sprintf("--http-port=%d", EndpointHTTPPort), fmt.Sprintf("--udp-port=%d", EndpointUDPPort), }, @@ -470,8 +470,8 @@ func (config *NetworkingTestConfig) createTestPodSpec() *v1.Pod { Name: "webserver", Image: netexecImageName, ImagePullPolicy: v1.PullIfNotPresent, - Command: []string{ - "/netexec", + Args: []string{ + "netexec", fmt.Sprintf("--http-port=%d", EndpointHTTPPort), fmt.Sprintf("--udp-port=%d", EndpointUDPPort), }, diff --git a/test/e2e/framework/service_util.go b/test/e2e/framework/service_util.go index a6578b167bd..8195bc495b5 100644 --- a/test/e2e/framework/service_util.go +++ b/test/e2e/framework/service_util.go @@ -654,8 +654,8 @@ func (j *ServiceTestJig) newRCTemplate(namespace string) *v1.ReplicationControll Containers: []v1.Container{ { Name: "netexec", - Image: imageutils.GetE2EImage(imageutils.Netexec), - Args: []string{"--http-port=80", "--udp-port=80"}, + Image: imageutils.GetE2EImage(imageutils.Agnhost), + Args: []string{"netexec", "--http-port=80", "--udp-port=80"}, ReadinessProbe: &v1.Probe{ PeriodSeconds: 3, Handler: v1.Handler{ @@ -836,8 +836,8 @@ func newNetexecPodSpec(podName string, httpPort, udpPort int32, hostNetwork bool { Name: "netexec", Image: netexecImageName, - Command: []string{ - "/netexec", + Args: []string{ + "netexec", fmt.Sprintf("--http-port=%d", httpPort), fmt.Sprintf("--udp-port=%d", udpPort), }, diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index d2b5a6e7422..514c145ab89 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -450,7 +450,7 @@ func ProxyMode(f *Framework) (string, error) { Containers: []v1.Container{ { Name: "detector", - Image: imageutils.GetE2EImage(imageutils.Net), + Image: imageutils.GetE2EImage(imageutils.Agnhost), Command: []string{"/bin/sleep", "3600"}, }, }, diff --git a/test/e2e/framework/volume/fixtures.go b/test/e2e/framework/volume/fixtures.go index 14109726645..d915b16c157 100644 --- a/test/e2e/framework/volume/fixtures.go +++ b/test/e2e/framework/volume/fixtures.go @@ -665,11 +665,11 @@ func GeneratePodSecurityContext(fsGroup *int64, seLinuxOptions *v1.SELinuxOption } // GetTestImage returns the image name with the given input -// If the Node OS is windows, currently we return Nettest image for Windows node +// If the Node OS is windows, currently we return Agnhost image for Windows node // due to the issue of #https://github.com/kubernetes-sigs/windows-testing/pull/35. func GetTestImage(image string) string { if framework.NodeOSDistroIs("windows") { - return imageutils.GetE2EImage(imageutils.Nettest) + return imageutils.GetE2EImage(imageutils.Agnhost) } return image } diff --git a/test/e2e/kubectl/portforward.go b/test/e2e/kubectl/portforward.go index 42345e94a00..122b6290bb2 100644 --- a/test/e2e/kubectl/portforward.go +++ b/test/e2e/kubectl/portforward.go @@ -69,7 +69,8 @@ func pfPod(expectedClientData, chunks, chunkSize, chunkIntervalMillis string, bi Containers: []v1.Container{ { Name: "readiness", - Image: imageutils.GetE2EImage(imageutils.Netexec), + Image: imageutils.GetE2EImage(imageutils.Agnhost), + Args: []string{"netexec"}, ReadinessProbe: &v1.Probe{ Handler: v1.Handler{ Exec: &v1.ExecAction{ diff --git a/test/e2e/network/kube_proxy.go b/test/e2e/network/kube_proxy.go index 1200c63b6d5..42eea6213a2 100644 --- a/test/e2e/network/kube_proxy.go +++ b/test/e2e/network/kube_proxy.go @@ -37,7 +37,7 @@ import ( "github.com/onsi/gomega" ) -var kubeProxyE2eImage = imageutils.GetE2EImage(imageutils.Net) +var kubeProxyE2eImage = imageutils.GetE2EImage(imageutils.Agnhost) var _ = SIGDescribe("Network", func() { const ( @@ -102,8 +102,8 @@ var _ = SIGDescribe("Network", func() { Name: "e2e-net-client", Image: kubeProxyE2eImage, ImagePullPolicy: "Always", - Command: []string{ - "/net", "-serve", fmt.Sprintf("0.0.0.0:%d", testDaemonHTTPPort), + Args: []string{ + "net", "--serve", fmt.Sprintf("0.0.0.0:%d", testDaemonHTTPPort), }, }, }, @@ -124,10 +124,10 @@ var _ = SIGDescribe("Network", func() { Name: "e2e-net-server", Image: kubeProxyE2eImage, ImagePullPolicy: "Always", - Command: []string{ - "/net", - "-runner", "nat-closewait-server", - "-options", + Args: []string{ + "net", + "--runner", "nat-closewait-server", + "--options", fmt.Sprintf(`{"LocalAddr":"0.0.0.0:%v", "PostFindTimeoutSeconds":%v}`, testDaemonTCPPort, postFinTimeoutSeconds), diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index 344b843ecdf..4e485f6ebba 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -1272,7 +1272,7 @@ var _ = SIGDescribe("Services", func() { }() t.Name = "slow-terminating-unready-pod" - t.Image = imageutils.GetE2EImage(imageutils.Netexec) + t.Image = imageutils.GetE2EImage(imageutils.Agnhost) port := 80 terminateSeconds := int64(600) @@ -1292,7 +1292,7 @@ var _ = SIGDescribe("Services", func() { }, } rcSpec := framework.RcByNameContainer(t.Name, 1, t.Image, t.Labels, v1.Container{ - Args: []string{fmt.Sprintf("--http-port=%d", port)}, + Args: []string{"netexec", fmt.Sprintf("--http-port=%d", port)}, Name: t.Name, Image: t.Image, Ports: []v1.ContainerPort{{ContainerPort: int32(port), Protocol: v1.ProtocolTCP}}, diff --git a/test/e2e/node/pre_stop.go b/test/e2e/node/pre_stop.go index 2f26f7ffd95..b91f48ccd28 100644 --- a/test/e2e/node/pre_stop.go +++ b/test/e2e/node/pre_stop.go @@ -51,7 +51,8 @@ func testPreStop(c clientset.Interface, ns string) { Containers: []v1.Container{ { Name: "server", - Image: imageutils.GetE2EImage(imageutils.Nettest), + Image: imageutils.GetE2EImage(imageutils.Agnhost), + Args: []string{"nettest"}, Ports: []v1.ContainerPort{{ContainerPort: 8080}}, }, }, diff --git a/test/e2e_node/image_list.go b/test/e2e_node/image_list.go index 416bf509ea4..d3a30fa73da 100644 --- a/test/e2e_node/image_list.go +++ b/test/e2e_node/image_list.go @@ -51,7 +51,6 @@ var NodeImageWhiteList = sets.NewString( imageutils.GetE2EImage(imageutils.Nginx), imageutils.GetE2EImage(imageutils.Perl), imageutils.GetE2EImage(imageutils.ServeHostname), - imageutils.GetE2EImage(imageutils.Netexec), imageutils.GetE2EImage(imageutils.Nonewprivs), imageutils.GetPauseImageName(), gpu.GetGPUDevicePluginImage(), diff --git a/test/utils/image/manifest.go b/test/utils/image/manifest.go index b8ec2be788a..c98a0dc0852 100644 --- a/test/utils/image/manifest.go +++ b/test/utils/image/manifest.go @@ -105,8 +105,6 @@ var ( const ( // CRDConversionWebhook image CRDConversionWebhook = iota - // AdmissionWebhook image - AdmissionWebhook // Agnhost image Agnhost // Alpine image @@ -163,12 +161,6 @@ const ( MounttestUser // Nautilus image Nautilus - // Net image - Net - // Netexec image - Netexec - // Nettest image - Nettest // Nginx image Nginx // NginxNew image @@ -217,8 +209,7 @@ const ( func initImageConfigs() map[int]Config { configs := map[int]Config{} configs[CRDConversionWebhook] = Config{e2eRegistry, "crd-conversion-webhook", "1.13rev2"} - configs[AdmissionWebhook] = Config{e2eRegistry, "webhook", "1.15v1"} - configs[Agnhost] = Config{e2eRegistry, "agnhost", "2.0"} + configs[Agnhost] = Config{e2eRegistry, "agnhost", "2.1"} configs[Alpine] = Config{dockerLibraryRegistry, "alpine", "3.7"} configs[AuthenticatedAlpine] = Config{gcAuthenticatedRegistry, "alpine", "3.7"} configs[APIServer] = Config{e2eRegistry, "sample-apiserver", "1.10"} @@ -245,9 +236,6 @@ func initImageConfigs() map[int]Config { configs[Mounttest] = Config{e2eRegistry, "mounttest", "1.0"} configs[MounttestUser] = Config{e2eRegistry, "mounttest-user", "1.0"} configs[Nautilus] = Config{e2eRegistry, "nautilus", "1.0"} - configs[Net] = Config{e2eRegistry, "net", "1.0"} - configs[Netexec] = Config{e2eRegistry, "netexec", "1.1"} - configs[Nettest] = Config{e2eRegistry, "nettest", "1.0"} configs[Nginx] = Config{dockerLibraryRegistry, "nginx", "1.14-alpine"} configs[NginxNew] = Config{dockerLibraryRegistry, "nginx", "1.15-alpine"} configs[Nonewprivs] = Config{e2eRegistry, "nonewprivs", "1.0"}