Skip to content

Commit eb343b1

Browse files
committed
cmd/openshift-install/create: Replace Routes().List with Get
We know the name we're looking for, so a Get should be slightly more efficient. The list landed with the route logic in ff53523 (add logs at end of install for kubeadmin, consoleURL, 2018-12-06, openshift#806) without clear motivation. It's possible that the intention was shielding from the console operator renaming their route, with the: Route found in openshift-console namespace: ... lines pointing us at the renamed route. But it seems unlikely that any such renaming would happen, and if it does, we expect the console-operator change to fail its end-to-end testing with the installer not finding a route with the old name.
1 parent aafdb62 commit eb343b1

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

cmd/openshift-install/create.go

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -440,20 +440,15 @@ func waitForConsole(ctx context.Context, config *rest.Config) (string, error) {
440440
silenceRemaining := logDownsample
441441
timer.StartTimer("Console")
442442
wait.Until(func() {
443-
consoleRoutes, err := rc.RouteV1().Routes(consoleNamespace).List(ctx, metav1.ListOptions{})
444-
if err == nil && len(consoleRoutes.Items) > 0 {
445-
for _, route := range consoleRoutes.Items {
446-
logrus.Debugf("Route found in openshift-console namespace: %s", route.Name)
447-
if route.Name == consoleRouteName {
448-
if uri, _, err2 := routeapihelpers.IngressURI(&route, ""); err2 == nil {
449-
url = uri.String()
450-
logrus.Debug("OpenShift console route is admitted")
451-
cancel()
452-
} else {
453-
err = err2
454-
}
455-
break
456-
}
443+
route, err := rc.RouteV1().Routes(consoleNamespace).Get(ctx, consoleRouteName, metav1.GetOptions{})
444+
if err == nil {
445+
logrus.Debugf("Route found in openshift-console namespace: %s", consoleRouteName)
446+
if uri, _, err2 := routeapihelpers.IngressURI(route, ""); err2 == nil {
447+
url = uri.String()
448+
logrus.Debug("OpenShift console route is admitted")
449+
cancel()
450+
} else {
451+
err = err2
457452
}
458453
}
459454
if err != nil {
@@ -462,12 +457,6 @@ func waitForConsole(ctx context.Context, config *rest.Config) (string, error) {
462457
logrus.Debugf("Still waiting for the console route: %v", err)
463458
silenceRemaining = logDownsample
464459
}
465-
} else if len(consoleRoutes.Items) == 0 {
466-
silenceRemaining--
467-
if silenceRemaining == 0 {
468-
logrus.Debug("Still waiting for the console route...")
469-
silenceRemaining = logDownsample
470-
}
471460
}
472461
}, 2*time.Second, consoleRouteContext.Done())
473462
err = consoleRouteContext.Err()

0 commit comments

Comments
 (0)