Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all cloud commands to top-level root #117

Merged
merged 7 commits into from
Sep 13, 2021

Conversation

hasheddan
Copy link
Contributor

Description of your changes

Moves all cloud commands to the top-level root, resulting in:

  • up login
  • up logout
  • up controlplane ...

This is a fairly large breaking change, but should be straightforward for users to adapt to. The most noticeable change is that the on-disk config file structure is slightly modified. But a user running up login will automatically have their config file restructured in the new format. They will be required to login each profile they previously had.

Expand for prior command structure
馃 (up) up -h
Usage: up <command>

The Upbound CLI

Flags:
  -h, --help       Show context-sensitive help.
  -v, --version    Print version and exit.

Commands:
  license
    Print Up license information.

cloud
  cloud login
    Login to Upbound Cloud.

  cloud logout
    Logout from Upbound Cloud.

  cloud controlplane attach <name>
    Attach a self-hosted control plane.

  cloud controlplane create <name>
    Create a hosted control plane.

  cloud controlplane delete <id>
    Delete a control plane.

  cloud controlplane list
    List control planes for the account.

  cloud controlplane kubeconfig get --token=STRING <control-plane-ID>
    Get a kubeconfig for a control plane.

  cloud controlplane token create <control-plane-ID>
    Create a control plane token.

  cloud controlplane token delete <token-ID>
    Delete a control plane token.

  cloud controlplane token list <control-plane-ID>
    List tokens for the control plane.

enterprise
  enterprise install <version>
    Install enterprise.

  enterprise uninstall
    Uninstall enterprise.

  enterprise upgrade <version>
    Upgrade enterprise.

uxp
  uxp install [<version>]
    Install UXP.

  uxp uninstall
    Uninstall UXP.

  uxp upgrade [<version>]
    Upgrade UXP.

  uxp connect <cp-token>
    Connect UXP to Upbound Cloud.

xpkg
  xpkg build
    Build a package.

  xpkg push <tag>
    Push a package.

Run "up <command> --help" for more information on a command.

Expand for new command structure
馃 (up) up -h
Usage: up <command>

The Upbound CLI

Flags:
  -h, --help       Show context-sensitive help.
  -v, --version    Print version and exit.

Commands:
  license
    Print Up license information.

  login
    Login to Upbound.

  logout
    Logout of Upbound.

controlplane
  controlplane attach <name>
    Attach a self-hosted control plane.

  controlplane create <name>
    Create a hosted control plane.

  controlplane delete <id>
    Delete a control plane.

  controlplane list
    List control planes for the account.

  controlplane kubeconfig get --token=STRING <control-plane-ID>
    Get a kubeconfig for a control plane.

  controlplane token create <control-plane-ID>
    Create a control plane token.

  controlplane token delete <token-ID>
    Delete a control plane token.

  controlplane token list <control-plane-ID>
    List tokens for the control plane.

enterprise
  enterprise install <version>
    Install enterprise.

  enterprise uninstall
    Uninstall enterprise.

  enterprise upgrade <version>
    Upgrade enterprise.

uxp
  uxp install [<version>]
    Install UXP.

  uxp uninstall
    Uninstall UXP.

  uxp upgrade [<version>]
    Upgrade UXP.

  uxp connect <cp-token>
    Connect UXP to Upbound Cloud.

xpkg
  xpkg build
    Build a package.

  xpkg push <tag>
    Push a package.

Run "up <command> --help" for more information on a command.

Fixes #114

I have:

  • Read and followed Upbound's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, as appropriate.

How has this code been tested

I have tested each set of the commands that have been moved, including:

  • Logging in: up login
  • Logging in with default account: up login -a dan
  • Logging out and confirming access denied afterwards: up logout
  • Creating a hosted controlplane: up ctp create test -a dan
  • Connecting to a hosted controlplane and listing pods: up ctp kubeconfig get --token=<token> <cp-id> -a dan k get pods -A
  • Listing tokens for a controlplane: up ctp token list <cp-id> -a dan
  • Deleting a hosted controlplane: up ctp delete <cp-id>

Updates the internal config structure and methods to use upbound instead
of cloud to refer to configuration that is related to interacting with
Upbound. This is a breaking change despite being an internal package,
but it will only require users logging in again, at which point their
existing config file will be overwritten with the revised structure.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Renames the internal cloud package to upbound to reflect that the
context it provides is for interacting with the upbound API.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Moves the ExtractConfig helper function to the config package where it
can live alongside the data structures it interacts with.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates all Upbound Cloud commands to consume the refactored structure
of the config and upbound packages. No functional changes.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Moves all cloud commands to root level as they should be used for
interacting with Upbound, not just Upbound Cloud.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
BeforeApply hooks must return an error, so we ignore linter error that
we always return nil.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
cmd/up/controlplane/attach.go Outdated Show resolved Hide resolved
Updates all commands to accept kong.Context with name kongCtx for
consistency. Also removed the parameter from some commands and hooks
that do not require it.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
@hasheddan hasheddan merged commit 2b5a1d3 into upbound:main Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider moving all cloud commands to top level
2 participants