upbound / up

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

Split `up version` into client and server #509

Closed RedbackThomson closed 1 month ago

RedbackThomson commented 1 month ago

Description of your changes

Fixes https://github.com/upbound/up/issues/504

I have:

How has this code been tested

When connected to a cloud space, where you are not allowed to query for the spaces controller version, up version returns the following response:

$ ./up ctx
Kubeconfig context "" switched to: Upbound upbound/upbound-gcp-us-west-1/craigs-group/controlplane1
$ ./up version
Client:
  Version:     v0.30.0-rc.0.18.gcbb90cc.dirty
  Go Version:  go1.22.1
  Git Commit:  cbb90cc
  OS/Arch:     darwin/arm64
Server:
  Crossplane Version:        v1.14.8-up.1
  Spaces Controller Version: Upbound Cloud Managed

If not able to connect to a cluster, or spaces does not exist on a cluster, the client will print an error to stderr.

$ ./up version
unable to get crossplane version. Is your kubecontext pointed at a control plane?
unable to get spaces version. Is your kubecontext pointed at a Space?
Client:
  Version:     v0.30.0-rc.0.18.gcbb90cc.dirty
  Go Version:  go1.22.1
  Git Commit:  cbb90cc
  OS/Arch:     darwin/arm64
Server:
  Crossplane Version:        unknown
  Spaces Controller Version: unknown

Also now supports JSON and YAML output:

$ ./up version --format=json
unable to get spaces version. Is your kubecontext pointed at a Space?
{
    "client": {
        "arch": "arm64",
        "gitCommit": "cbb90cc",
        "goVersion": "go1.22.1",
        "os": "darwin",
        "version": "v0.30.0-rc.0.18.gcbb90cc.dirty"
    },
    "server": {
        "crossplaneVersion": "v1.14.8-up.1",
        "spacesControllerVersion": "Upbound Cloud Managed"
    }
}