diff --git a/cmd/openshift-install/create.go b/cmd/openshift-install/create.go index 23e1852d15a..199357e6df9 100644 --- a/cmd/openshift-install/create.go +++ b/cmd/openshift-install/create.go @@ -13,6 +13,7 @@ import ( "github.com/sirupsen/logrus" "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/util/wait" @@ -485,8 +486,8 @@ func waitForInitializedCluster(ctx context.Context, config *rest.Config) error { return errors.Wrap(err, "failed to initialize the cluster") } -// waitForConsole returns the console URL from the route 'console' in namespace openshift-console -func waitForConsole(ctx context.Context, config *rest.Config) (string, error) { +// getConsole returns the console URL from the route 'console' in namespace openshift-console +func getConsole(ctx context.Context, config *rest.Config) (string, error) { url := "" // Need to keep these updated if they change consoleNamespace := "openshift-console" @@ -496,8 +497,8 @@ func waitForConsole(ctx context.Context, config *rest.Config) (string, error) { return "", errors.Wrap(err, "creating a route client") } - consoleRouteTimeout := 10 * time.Minute - logrus.Infof("Waiting up to %v for the openshift-console route to be created...", consoleRouteTimeout) + consoleRouteTimeout := 2 * time.Minute + logrus.Infof("Checking to see if there is a route at %s/%s...", consoleNamespace, consoleRouteName) consoleRouteContext, cancel := context.WithTimeout(ctx, consoleRouteTimeout) defer cancel() // Poll quickly but only log when the response @@ -517,7 +518,11 @@ func waitForConsole(ctx context.Context, config *rest.Config) (string, error) { } else { err = err2 } + } else if apierrors.IsNotFound(err) { + logrus.Debug("OpenShift console route does not exist") + cancel() } + if err != nil { silenceRemaining-- if silenceRemaining == 0 { @@ -551,8 +556,10 @@ func logComplete(directory, consoleURL string) error { } logrus.Info("Install complete!") logrus.Infof("To access the cluster as the system:admin user when using 'oc', run 'export KUBECONFIG=%s'", kubeconfig) - logrus.Infof("Access the OpenShift web-console here: %s", consoleURL) - logrus.Infof("Login to the console with user: %q, and password: %q", "kubeadmin", pw) + if consoleURL != "" { + logrus.Infof("Access the OpenShift web-console here: %s", consoleURL) + logrus.Infof("Login to the console with user: %q, and password: %q", "kubeadmin", pw) + } return nil } @@ -561,13 +568,13 @@ func waitForInstallComplete(ctx context.Context, config *rest.Config, directory return err } - consoleURL, err := waitForConsole(ctx, config) - if err != nil { - return err - } - - if err = addRouterCAToClusterCA(ctx, config, rootOpts.dir); err != nil { - return err + consoleURL, err := getConsole(ctx, config) + if err == nil { + if err = addRouterCAToClusterCA(ctx, config, rootOpts.dir); err != nil { + return err + } + } else { + logrus.Warnf("Cluster does not have a console available: %v", err) } return logComplete(rootOpts.dir, consoleURL)