Prevent races across prometheus installs
@@ -319,6 +319,7 @@ func bringUpPrometheusFromTemplate(oc *exutil.CLI) (ns, host, bearerToken string
}
waitForServiceAccountInNamespace(oc.AdminKubeClient(), "kube-system", "prometheus", 2*time.Minute)
+ for i := 0; i < 30; i++ {
secrets, err := oc.AdminKubeClient().Core().Secrets("kube-system").List(metav1.ListOptions{})
o.Expect(err).NotTo(o.HaveOccurred())
for _, secret := range secrets.Items {
@@ -331,6 +332,12 @@ func bringUpPrometheusFromTemplate(oc *exutil.CLI) (ns, host, bearerToken string
bearerToken = string(secret.Data[v1.ServiceAccountTokenKey])
break
}
+ if len(bearerToken) == 0 {
+ e2e.Logf("Waiting for prometheus service account secret to show up")
+ time.Sleep(time.Second)
+ continue
+ }
+ }
o.Expect(bearerToken).ToNot(o.BeEmpty())
return
