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)