@@ -11,7 +11,6 @@ import (
1111
1212 batchv1 "k8s.io/api/batch/v1"
1313 corev1 "k8s.io/api/core/v1"
14- apierrors "k8s.io/apimachinery/pkg/api/errors"
1514 "k8s.io/apimachinery/pkg/api/meta"
1615 "k8s.io/apimachinery/pkg/api/resource"
1716 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -77,38 +76,12 @@ func verifyCatalogEndpoint(ctx SpecContext, catalog, endpoint, query string) {
7776 strings .ReplaceAll (endpoint , "?" , "" ),
7877 strings .ReplaceAll (catalog , "-" , "" ))
7978
80- // create service account object
81- serviceAccount := & corev1.ServiceAccount {
82- ObjectMeta : metav1.ObjectMeta {
83- Name : jobNamePrefix ,
84- Namespace : "default" ,
85- },
86- }
87-
88- err = k8sClient .Create (ctx , serviceAccount )
89-
90- Expect (err ).To (Or (BeNil (), Satisfy (apierrors .IsAlreadyExists )),
91- "Failed to ensure ServiceAccount %s" , jobNamePrefix )
92-
93- DeferCleanup (func (ctx SpecContext ) {
94- _ = k8sClient .Delete (ctx , serviceAccount )
95- })
96-
97- job := buildCurlJob (jobNamePrefix , "default" , serviceURL , serviceAccount )
98-
79+ job := buildCurlJob (jobNamePrefix , "default" , serviceURL )
9980 err = k8sClient .Create (ctx , job )
10081 Expect (err ).NotTo (HaveOccurred (), "failed to create Job" )
10182
10283 DeferCleanup (func (ctx SpecContext ) {
10384 _ = k8sClient .Delete (ctx , job )
104- // We poll for deletion success so that the cleanup succeeds only when
105- // the job is deleted. Then, we can move onto deleting the service
106- // account without issue.
107- Eventually (func (g Gomega ) {
108- recheck := & batchv1.Job {}
109- err := k8sClient .Get (ctx , client .ObjectKeyFromObject (job ), recheck )
110- g .Expect (apierrors .IsNotFound (err )).To (BeTrue (), fmt .Sprintf ("Job %v should be deleted" , job .Name ))
111- }).WithTimeout (helpers .DefaultTimeout ).WithPolling (helpers .DefaultPolling ).Should (Succeed ())
11285 })
11386
11487 By ("Waiting for Job to succeed" )
@@ -230,7 +203,7 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1
230203 })
231204})
232205
233- func buildCurlJob (prefix , namespace , url string , serviceAccount * corev1. ServiceAccount ) * batchv1.Job {
206+ func buildCurlJob (prefix , namespace , url string ) * batchv1.Job {
234207 backoff := int32 (1 )
235208 // This means the k8s garbage collector will automatically delete the job 5 minutes
236209 // after it has completed or failed.
@@ -259,8 +232,7 @@ func buildCurlJob(prefix, namespace, url string, serviceAccount *corev1.ServiceA
259232 BackoffLimit : & backoff ,
260233 Template : corev1.PodTemplateSpec {
261234 Spec : corev1.PodSpec {
262- ServiceAccountName : serviceAccount .Name ,
263- RestartPolicy : corev1 .RestartPolicyNever ,
235+ RestartPolicy : corev1 .RestartPolicyNever ,
264236 Containers : []corev1.Container {{
265237 Name : "api-tester" ,
266238 Image : "registry.redhat.io/rhel8/httpd-24:latest" ,
0 commit comments