upbound / up

The @upbound CLI
Apache License 2.0
52 stars 41 forks source link

Add support for `up ctp provider install` and `up ctp configuration install` #261

Closed hasheddan closed 1 year ago

hasheddan commented 1 year ago

Description of your changes

Adds configuration and provider install commands to the ctp group. The same struct is used for both commands, but variable interpolation is used to parameterize based on the subtree from which the command is invoked.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Fixes #159

I have:

How has this code been tested

Verified successful install of providers and configurations, as well as updates to functionality in up upbound commands.

🤖 (up) kind create cluster
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.21.1) đŸ–ŧ
 ✓ Preparing nodes đŸ“Ļ  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹ī¸ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂
🤖 (up) up uxp install
UXP 1.9.1-up.1 installed
🤖 (up) up ctp provider -h
Usage: up controlplane (ctp) provider <command>

Manage Providers.

Flags:
  -h, --help                         Show context-sensitive help.
  -v, --version                      Print version and exit.
  -q, --quiet                        Suppress all output.
      --pretty                       Pretty print output.

      --domain=https://upbound.io    Root Upbound domain ($UP_DOMAIN).
      --profile=STRING               Profile used to execute command ($UP_PROFILE).
  -a, --account=STRING               Account used to execute command ($UP_ACCOUNT).
      --insecure-skip-tls-verify     [INSECURE] Skip verifying TLS certificates ($UP_INSECURE_SKIP_TLS_VERIFY).

Commands:
  controlplane (ctp) provider install    Install a Provider.
🤖 (up) up ctp configuraiton -h
up: error: unexpected argument configuraiton, did you mean "configuration"?
🤖 (up) up ctp configuration -h
Usage: up controlplane (ctp) configuration <command>

Manage Configurations.

Flags:
  -h, --help                         Show context-sensitive help.
  -v, --version                      Print version and exit.
  -q, --quiet                        Suppress all output.
      --pretty                       Pretty print output.

      --domain=https://upbound.io    Root Upbound domain ($UP_DOMAIN).
      --profile=STRING               Profile used to execute command ($UP_PROFILE).
  -a, --account=STRING               Account used to execute command ($UP_ACCOUNT).
      --insecure-skip-tls-verify     [INSECURE] Skip verifying TLS certificates ($UP_INSECURE_SKIP_TLS_VERIFY).

Commands:
  controlplane (ctp) configuration install    Install a Configuration.
🤖 (up) up ctp provider install -h
Usage: up controlplane (ctp) provider install <package>

Install a Provider.

Arguments:
  <package>    Reference to the Provider.

Flags:
  -h, --help                                             Show context-sensitive help.
  -v, --version                                          Print version and exit.
  -q, --quiet                                            Suppress all output.
      --pretty                                           Pretty print output.

      --domain=https://upbound.io                        Root Upbound domain ($UP_DOMAIN).
      --profile=STRING                                   Profile used to execute command ($UP_PROFILE).
  -a, --account=STRING                                   Account used to execute command ($UP_ACCOUNT).
      --insecure-skip-tls-verify                         [INSECURE] Skip verifying TLS certificates ($UP_INSECURE_SKIP_TLS_VERIFY).

      --kubeconfig=STRING                                Override default kubeconfig path.
      --name=STRING                                      Name of Provider.
      --package-pull-secrets=PACKAGE-PULL-SECRETS,...    List of secrets used to pull Provider.
  -w, --wait=DURATION                                    Wait duration for successful Provider installation.
🤖 (up) up ctp configuration install -h
Usage: up controlplane (ctp) configuration install <package>

Install a Configuration.

Arguments:
  <package>    Reference to the Configuration.

Flags:
  -h, --help                                             Show context-sensitive help.
  -v, --version                                          Print version and exit.
  -q, --quiet                                            Suppress all output.
      --pretty                                           Pretty print output.

      --domain=https://upbound.io                        Root Upbound domain ($UP_DOMAIN).
      --profile=STRING                                   Profile used to execute command ($UP_PROFILE).
  -a, --account=STRING                                   Account used to execute command ($UP_ACCOUNT).
      --insecure-skip-tls-verify                         [INSECURE] Skip verifying TLS certificates ($UP_INSECURE_SKIP_TLS_VERIFY).

      --kubeconfig=STRING                                Override default kubeconfig path.
      --name=STRING                                      Name of Configuration.
      --package-pull-secrets=PACKAGE-PULL-SECRETS,...    List of secrets used to pull Configuration.
  -w, --wait=DURATION                                    Wait duration for successful Configuration installation.
🤖 (up) up ctp provider install upbound/provider-aws:v0.15.0 --package-pull-secrets=pull-sec -w 30s --pretty
  √   upbound-provider-aws installed and healthy                                                                                                                                                               
🤖 (up) k get pkg
NAME                                              INSTALLED   HEALTHY   PACKAGE                                        AGE
provider.pkg.crossplane.io/upbound-provider-aws   True        True      xpkg.upbound.io/upbound/provider-aws:v0.15.0   33s
🤖 (up) up ctp configuration install upbound/platform-ref-aws:v0.2.3
upbound-platform-ref-aws installed
🤖 (up) k get pkg
NAME                                                 INSTALLED   HEALTHY   PACKAGE                                                                 AGE
provider.pkg.crossplane.io/crossplane-provider-aws   True        Unknown   registry.upbound.io/crossplane/provider-aws:v0.32.0-rc.0.47.gd90a07b6   7s
provider.pkg.crossplane.io/upbound-provider-aws      True        True      xpkg.upbound.io/upbound/provider-aws:v0.15.0                            101s

NAME                                                       INSTALLED   HEALTHY   PACKAGE                                           AGE
configuration.pkg.crossplane.io/upbound-platform-ref-aws   True        Unknown   xpkg.upbound.io/upbound/platform-ref-aws:v0.2.3   10s