From 69182296da52c3e3256007f64300dc20a5ede721 Mon Sep 17 00:00:00 2001 From: Stephen Benjamin Date: Thu, 16 Jan 2020 09:10:25 -0500 Subject: [PATCH 1/2] cmd/openshift-install/create: add env var to preserve bootstrap For a variety of reasons, it may be useful to keep the bootstrap VM around for debugging. My general approach has been to interrupt the installer before it has a chance to delete the bootstrap VM. If the environment variable OPENSHIFT_INSTALL_PRESERVE_BOOTSTRAP is set to any value, the installer will not delete the bootstrap. --- cmd/openshift-install/create.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/openshift-install/create.go b/cmd/openshift-install/create.go index f9ae4c6bb39..ad175d162ee 100644 --- a/cmd/openshift-install/create.go +++ b/cmd/openshift-install/create.go @@ -5,6 +5,7 @@ import ( "crypto/x509" "fmt" "io/ioutil" + "os" "path/filepath" "strings" "time" @@ -105,10 +106,15 @@ var ( logrus.Fatal("Bootstrap failed to complete: ", err) } - logrus.Info("Destroying the bootstrap resources...") - err = destroybootstrap.Destroy(rootOpts.dir) - if err != nil { - logrus.Fatal(err) + if oi, ok := os.LookupEnv("OPENSHIFT_INSTALL_PRESERVE_BOOTSTRAP"); ok && oi != "" { + logrus.Warn("OPENSHIFT_INSTALL_PRESERVE_BOOTSTRAP is set, not destroying bootstrap resources. " + + "Warning: this should only be used for debugging purposes, and poses a risk to cluster stability.") + } else { + logrus.Info("Destroying the bootstrap resources...") + err = destroybootstrap.Destroy(rootOpts.dir) + if err != nil { + logrus.Fatal(err) + } } err = waitForInstallComplete(ctx, config, rootOpts.dir) From 496d656f2be137d03bff198bf9c980f17a318a77 Mon Sep 17 00:00:00 2001 From: Sam Batschelet Date: Tue, 28 Jan 2020 12:41:16 -0500 Subject: [PATCH 2/2] cmd/openshift-install: shift timeouts from api to bootstrap Signed-off-by: Sam Batschelet --- cmd/openshift-install/create.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/openshift-install/create.go b/cmd/openshift-install/create.go index ad175d162ee..20ca86fc56a 100644 --- a/cmd/openshift-install/create.go +++ b/cmd/openshift-install/create.go @@ -250,7 +250,7 @@ func waitForBootstrapComplete(ctx context.Context, config *rest.Config, director discovery := client.Discovery() - apiTimeout := 30 * time.Minute + apiTimeout := 20 * time.Minute logrus.Infof("Waiting up to %v for the Kubernetes API at %s...", apiTimeout, config.Host) apiContext, cancel := context.WithTimeout(ctx, apiTimeout) defer cancel() @@ -291,7 +291,7 @@ func waitForBootstrapComplete(ctx context.Context, config *rest.Config, director // and waits for the bootstrap configmap to report that bootstrapping has // completed. func waitForBootstrapConfigMap(ctx context.Context, client *kubernetes.Clientset) error { - timeout := 30 * time.Minute + timeout := 40 * time.Minute logrus.Infof("Waiting up to %v for bootstrapping to complete...", timeout) waitCtx, cancel := context.WithTimeout(ctx, timeout)