Skip to content

Instantly share code, notes, and snippets.

@sttts
Created December 15, 2020 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sttts/5e837fe18c64fe2f32828b2674cc3947 to your computer and use it in GitHub Desktop.
Save sttts/5e837fe18c64fe2f32828b2674cc3947 to your computer and use it in GitHub Desktop.
diff --git a/pkg/start/start.go b/pkg/start/start.go
index 01a0ce30..e8811fb4 100644
--- a/pkg/start/start.go
+++ b/pkg/start/start.go
@@ -127,8 +127,6 @@ func (b *startCommand) Run() error {
if err = waitUntilPodsRunning(ctx, client, b.requiredPodPrefixes); err != nil {
return err
}
- cancel()
- assetsDone.Wait()
// notify installer that we are ready to tear down the temporary bootstrap control plane
UserOutput("Sending bootstrap-success event.")
@@ -136,42 +134,42 @@ func (b *startCommand) Run() error {
return err
}
- // continue with assets
- ctx, cancel = context.WithTimeout(context.Background(), assetsCreatedTimeout)
- defer cancel()
if b.earlyTearDown {
+ cancel()
+ assetsDone.Wait()
+
+ // continue with assets
+ ctx, cancel = context.WithTimeout(context.Background(), assetsCreatedTimeout)
+ defer cancel()
+
// switch over to ELB client and continue with the assets
assetsDone = createAssetsInBackground(ctx, cancel, restConfig)
- } else {
- // we don't tear down the local control plane early. So we can keep using it and enjoy the speed up.
- assetsDone = createAssetsInBackground(ctx, cancel, localClientConfig)
- }
- // optionally wait for tear down event coming from the installer. This is necessary to
- // remove the bootstrap node from the AWS load balancer.
- if len(b.waitForTearDownEvent) != 0 {
- ss := strings.Split(b.waitForTearDownEvent, "/")
- if len(ss) != 2 {
- return fmt.Errorf("tear down event name of format <namespace>/<event-name> expected, got: %q", b.waitForTearDownEvent)
- }
- ns, name := ss[0], ss[1]
- if err := waitForEvent(context.TODO(), client, ns, name); err != nil {
- return err
+ // optionally wait for tear down event coming from the installer. This is necessary to
+ // remove the bootstrap node from the AWS load balancer.
+ if len(b.waitForTearDownEvent) != 0 {
+ ss := strings.Split(b.waitForTearDownEvent, "/")
+ if len(ss) != 2 {
+ return fmt.Errorf("tear down event name of format <namespace>/<event-name> expected, got: %q", b.waitForTearDownEvent)
+ }
+ ns, name := ss[0], ss[1]
+ if err := waitForEvent(context.TODO(), client, ns, name); err != nil {
+ return err
+ }
+ UserOutput("Got %s event.", b.waitForTearDownEvent)
}
- UserOutput("Got %s event.", b.waitForTearDownEvent)
- }
- // tear down the bootstrap control plane. Set bcp to nil to avoid a second tear down in the defer func.
- if b.earlyTearDown {
+ // tear down the bootstrap control plane. Set bcp to nil to avoid a second tear down in the defer func.
err = bcp.Teardown()
bcp = nil
if err != nil {
UserOutput("Error tearing down temporary bootstrap control plane: %v\n", err)
}
+
+ // wait for the tail of assets to be created after tear down
+ UserOutput("Waiting for remaining assets to be created.\n")
}
- // wait for the tail of assets to be created after tear down
- UserOutput("Waiting for remaining assets to be created.\n")
assetsDone.Wait()
UserOutput("Sending bootstrap-finished event.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment