upbound / up

The @upbound CLI
Apache License 2.0
50 stars 42 forks source link

connect fixes #461

Closed avalanche123 closed 3 months ago

avalanche123 commented 3 months ago

Description of your changes

Fixes upbound/connect#179

Additional flows that are enabled by this PR:

Detach space when no connect configmap exists in the space cluster but space name is specified.

This would previously exit without doing anything, instead the flow is now:

% up alpha space detach space-bulat-test
 INFO  ConfigMap "upbound-system/space-token" not found

 WARNING  We're unable to confirm Space "upbound-papper-cutters/space-bulat-test" is currently connected to Upbound Console. Would you like to delete it anyway?

            If the other Space cluster still exists, the Upbound agent will be left running and you will need to delete it manually.

 ▀ Continue? (Y/n) (12s)

 INFO  Looking for Robot "upbound-papper-cutters/space-bulat-test"
 INFO  Deleting Robot "upbound-papper-cutters/space-bulat-test"
 INFO  Robot "upbound-papper-cutters/space-bulat-test" deleted
 INFO  Deleting Space "upbound-papper-cutters/space-bulat-test"
 INFO  Uninstalling Chart "upbound-system/agent"
 INFO  Chart "upbound-system/agent" uninstalled
 INFO  Deleting Secret "upbound-system/space-token"
 INFO  Secret "upbound-system/space-token" deleted
  ✓   Space "upbound-papper-cutters/space-bulat-test" has been successfully disconnected from Upbound Console

Attach a space that is currently attached under a different name.

Previously this flow would create a new space in Upbound console and leave the old Space quietly broken. The new behavior is as follows:

% up alpha space attach space-bulat-test-2
 INFO  ConfigMap "upbound-system/space-connect" found, resuming...

 WARNING  Space "upbound-papper-cutters/space-bulat-test" is currently connected to Upbound Console, would you like to disconnect it first?

            This will remove it and re-connect the Upbound agent with Space "upbound-papper-cutters/space-bulat-test-2" instead.

▄  Continue? (Y/n) (11s)

 INFO  Looking for Robot "upbound-papper-cutters/space-bulat-test"
 INFO  Deleting Robot "upbound-papper-cutters/space-bulat-test"
 INFO  Robot "upbound-papper-cutters/space-bulat-test" deleted
 INFO  Deleting Space "upbound-papper-cutters/space-bulat-test"
 INFO  Creating Space "upbound-papper-cutters/space-bulat-test-2"
 INFO  Space "upbound-papper-cutters/space-bulat-test-2" created
 INFO  Creating Robot "upbound-papper-cutters/space-bulat-test-2"
 INFO  Robot "upbound-papper-cutters/space-bulat-test-2" created
 INFO  Creating a new Token for Robot "upbound-papper-cutters/space-bulat-test-2"
 INFO  Token "319b6cf2-2bca-46de-890f-8cde496aae19" created
 INFO  Creating Secret "upbound-system/space-token"
 INFO  Secret "upbound-system/space-token" exists, updating...
 INFO  Secret "upbound-system/space-token" updated
 INFO  Reinstalling Chart "upbound-system/agent" 0.0.0-309.gd29fc13
  ✓   Space "space-bulat-test-2" is connected to Upbound Console

I have:

How has this code been tested

Ran the attach/detach multiple times, see description.