@@ -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"
@@ -78,42 +77,12 @@ func verifyCatalogEndpoint(ctx SpecContext, catalog, endpoint, query string) {
7877 strings .ReplaceAll (endpoint , "?" , "" ),
7978 strings .ReplaceAll (catalog , "-" , "" ))
8079
81- // create service account object
82- serviceAccount := & corev1.ServiceAccount {
83- ObjectMeta : metav1.ObjectMeta {
84- Name : jobNamePrefix ,
85- Namespace : "default" ,
86- },
87- }
88-
89- serviceAccount .SetName (jobNamePrefix )
90- serviceAccount .SetNamespace ("default" )
91-
92- err = k8sClient .Create (ctx , serviceAccount )
93- Expect (err ).NotTo (HaveOccurred (), "failed to create Service Account" )
94-
95- DeferCleanup (func (ctx SpecContext ) {
96- _ = k8sClient .Delete (ctx , serviceAccount )
97- })
98-
99- if err != nil && ! apierrors .IsAlreadyExists (err ) {
100- Fail (fmt .Sprintf ("Failed to ensure ServiceAccount %s: %v" , jobNamePrefix , err ))
101- }
102-
103- job := buildCurlJob (jobNamePrefix , "default" , serviceURL , serviceAccount )
80+ job := buildCurlJob (jobNamePrefix , "default" , serviceURL )
10481 err = k8sClient .Create (ctx , job )
10582 Expect (err ).NotTo (HaveOccurred (), "failed to create Job" )
10683
10784 DeferCleanup (func (ctx SpecContext ) {
108- By ("Deleting Job and waiting for pods to terminate" )
10985 _ = k8sClient .Delete (ctx , job )
110-
111- // Wait for Job to be fully deleted.
112- Eventually (func () bool {
113- checkJob := & batchv1.Job {}
114- err := k8sClient .Get (ctx , client .ObjectKeyFromObject (job ), checkJob )
115- return apierrors .IsNotFound (err )
116- }).WithTimeout (helpers .DefaultTimeout ).WithPolling (helpers .DefaultPolling ).Should (BeTrue ())
11786 })
11887
11988 By ("Waiting for Job to succeed" )
@@ -259,7 +228,7 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1
259228 })
260229})
261230
262- func buildCurlJob (prefix , namespace , url string , serviceAccount * corev1. ServiceAccount ) * batchv1.Job {
231+ func buildCurlJob (prefix , namespace , url string ) * batchv1.Job {
263232 backoff := int32 (1 )
264233 // This means the k8s garbage collector will automatically delete the job 5 minutes
265234 // after it has completed or failed.
@@ -288,8 +257,7 @@ func buildCurlJob(prefix, namespace, url string, serviceAccount *corev1.ServiceA
288257 BackoffLimit : & backoff ,
289258 Template : corev1.PodTemplateSpec {
290259 Spec : corev1.PodSpec {
291- ServiceAccountName : serviceAccount .Name ,
292- RestartPolicy : corev1 .RestartPolicyNever ,
260+ RestartPolicy : corev1 .RestartPolicyNever ,
293261 Containers : []corev1.Container {{
294262 Name : "api-tester" ,
295263 Image : "registry.redhat.io/rhel8/httpd-24:latest" ,
0 commit comments