From 3e182e84ea1ba98ac4e38d60c066e0904cdf3428 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Thu, 1 Oct 2020 12:28:06 +0200 Subject: [PATCH] e2e can't use both pod.Name and pod.GenerateName This fixes a problem when using the framework helper e2epod.CreateExecPodOrFail() more than once in the same test. The problem is that this function was creating pods with both the pod.Name and pod.GenerateName set. The second pod failed to be created with a 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, xref https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/ --- test/e2e/framework/pod/resource.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e/framework/pod/resource.go b/test/e2e/framework/pod/resource.go index 84a69cb87fd..f619094db76 100644 --- a/test/e2e/framework/pod/resource.go +++ b/test/e2e/framework/pod/resource.go @@ -456,7 +456,9 @@ func NewExecPodSpec(ns, name string, hostNetwork bool) *v1.Pod { // newExecPodSpec returns the pod spec of exec pod func newExecPodSpec(ns, generateName string) *v1.Pod { - pod := NewAgnhostPod(ns, "agnhost-pod", nil, nil, nil) + // GenerateName is an optional prefix, used by the server, + // to generate a unique name ONLY IF the Name field has not been provided + pod := NewAgnhostPod(ns, "", nil, nil, nil) pod.ObjectMeta.GenerateName = generateName return pod }