@@ -2310,18 +2310,28 @@ func IsHypershift(ctx context.Context, configClient clientconfigv1.Interface) (b
23102310// IsMicroShiftCluster returns "true" if a cluster is MicroShift,
23112311// "false" otherwise. It needs kube-admin client as input.
23122312func IsMicroShiftCluster (kubeClient k8sclient.Interface ) (bool , error ) {
2313- // MicroShift cluster contains "microshift-version" configmap in "kube-public" namespace
2314- cm , err := kubeClient .CoreV1 ().ConfigMaps ("kube-public" ).Get (context .Background (), "microshift-version" , metav1.GetOptions {})
2315- if err != nil {
2313+ ctx := context .Background ()
2314+ var cm * corev1.ConfigMap
2315+ duration := 5 * time .Minute
2316+ if err := wait .PollUntilContextTimeout (ctx , 10 * time .Second , duration , true , func (ctx context.Context ) (bool , error ) {
2317+ // MicroShift cluster contains "microshift-version" configmap in "kube-public" namespace
2318+ var err error
2319+ cm , err = kubeClient .CoreV1 ().ConfigMaps ("kube-public" ).Get (ctx , "microshift-version" , metav1.GetOptions {})
2320+ if err == nil {
2321+ return true , nil
2322+ }
23162323 if kapierrs .IsNotFound (err ) {
2317- e2e . Logf ( "microshift-version configmap not found" )
2318- return false , nil
2324+ cm = nil
2325+ return true , nil
23192326 }
23202327 e2e .Logf ("error accessing microshift-version configmap: %v" , err )
2328+ return false , nil
2329+ }); err != nil {
2330+ e2e .Logf ("failed to find microshift-version configmap while polling for %s: %v" , duration , err )
23212331 return false , err
23222332 }
23232333 if cm == nil {
2324- e2e .Logf ("microshift-version configmap is nil " )
2334+ e2e .Logf ("microshift-version configmap not found " )
23252335 return false , nil
23262336 }
23272337 e2e .Logf ("MicroShift cluster with version: %s" , cm .Data ["version" ])
0 commit comments