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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CentralRepo] Add tanzu plugin search command #52

Merged

Conversation

marckhouzam
Copy link
Contributor

What this PR does / why we need it

This commit provides the new "tanzu plugin search" command in its most basic form:

  • filtering is not yet supported
  • listing versions is not yet supported

This command is part of the Central Repository feature and therefore is only accessible if the features.global.central-repository feature flag is enabled.

The command works just as well with a Central Repo as a current plugin discovery. Therefore the commit is directly based on the main branch and can be tested with TKG and TMC discoveries.

Describe testing done for PR

$ rm ~/.config/tanzu/config*
$ tz config set features.global.central-repository true
$ tz context create --name k3d --kubecontext k3d-k3s-default --kubeconfig /Users/kmarc/.config/k3d/k3s-default/kubeconfig.yaml
$ tz plugin search
  NAME                DESCRIPTION                           TARGET      VERSION      STATUS         CONTEXT
  cluster             Kubernetes cluster operations         kubernetes  v0.38.0-dev  not installed  k3d
  feature             Operate on features and featuregates  kubernetes  v0.28.0-dev  not installed  k3d
  kubernetes-release  Kubernetes release operations         kubernetes  v0.28.0-dev  not installed  k3d

$ tz context create --name tmc-unstable --endpoint unstable.tmc-dev.cloud.vmware.com --staging

ℹ  If you don't have an API token, visit the VMware Cloud Services console, select your organization, and create an API token with the TMC service roles:
  https://console.cloud.vmware.com/csp/gateway/portal/#/user/tokens

? API Token ****************************************************************

✔  successfully created a TMC context
ℹ  Checking for required plugins...
ℹ  Installing plugin 'feature:v0.28.0-dev' with target 'kubernetes'
ℹ  Installing plugin 'kubernetes-release:v0.28.0-dev' with target 'kubernetes'
ℹ  Installing plugin 'cluster:v0.38.0-dev' with target 'kubernetes'
ℹ  Installing plugin 'events:v0.0.1' with target 'mission-control'
ℹ  Installing plugin 'inspection:v0.0.1' with target 'mission-control'
ℹ  Installing plugin 'cluster:v0.0.1' with target 'mission-control'
^C
$ tz plugin search
  NAME                DESCRIPTION                                                     TARGET           VERSION      STATUS         CONTEXT
  cluster             Kubernetes cluster operations                                   kubernetes       v0.38.0-dev  not installed  k3d
  feature             Operate on features and featuregates                            kubernetes       v0.28.0-dev  not installed  k3d
  kubernetes-release  Kubernetes release operations                                   kubernetes       v0.28.0-dev  not installed  k3d
  account             Account for tmc resources                                       mission-control  v0.0.1       not installed  tmc-unstable
  apply               Create/Update a resource with a resource file                   mission-control  v0.0.1       not installed  tmc-unstable
  audit               Run an audit request on an org                                  mission-control  v0.0.1       not installed  tmc-unstable
  cluster                                                                             mission-control  v0.0.1       not installed  tmc-unstable
  clustergroup        A group of Kubernetes clusters                                  mission-control  v0.0.1       not installed  tmc-unstable
  data-protection     Data protection for tmc resources                               mission-control  v0.0.1       not installed  tmc-unstable
  ekscluster                                                                          mission-control  v0.0.1       not installed  tmc-unstable
  events              Events for any meaningful user activity or system state change  mission-control  v0.0.1       installed      tmc-unstable
  iam                 IAM Policies for tmc resources                                  mission-control  v0.0.1       not installed  tmc-unstable
  inspection          Inspection for tmc resources                                    mission-control  v0.0.1       installed      tmc-unstable
  integration         Get available integrations and their information from registry  mission-control  v0.0.1       not installed  tmc-unstable
  management-cluster  A TMC registered Management cluster                             mission-control  v0.0.1       installed      tmc-unstable
  policy              Policy for tmc resources                                        mission-control  v0.0.1       not installed  tmc-unstable
  workspace           A group of Kubernetes namespaces                                mission-control  v0.0.1       not installed  tmc-unstable

$ tz plugin search hello
✖  the filter argument is not yet implemented
$ tz plugin search --list-versions
✖  listing versions is not yet implemented
$ tz plugin search --target mission-control
✖  filtering by target is not yet implemented

$ tz plugin search -o json
[
  {
    "context": "k3d",
    "description": "Kubernetes cluster operations",
    "name": "cluster",
    "status": "not installed",
    "target": "kubernetes",
    "version": "v0.38.0-dev"
  },
  {
    "context": "k3d",
[...]

$ tz plugin search --local ~/.config/tanzu-plugins/
  NAME                DESCRIPTION                                                        TARGET      VERSION      STATUS         CONTEXT
  builder             Build Tanzu components                                                         v0.28.0-dev  not installed
  codegen             Tanzu code generation tool                                                     v0.28.0-dev  not installed
  isolated-cluster    Prepopulating images/bundle for internet-restricted environments               v0.28.0-dev  not installed
  login               Login to the platform                                                          v0.28.0-dev  not installed
  pinniped-auth       Pinniped authentication operations (usually not directly invoked)              v0.28.0-dev  not installed
  test                Test the CLI                                                                   v0.28.0-dev  not installed
  cluster             Kubernetes cluster operations                                      kubernetes  v0.28.0-dev  not installed
  feature             Operate on features and featuregates                               kubernetes  v0.28.0-dev  not installed
  kubernetes-release  Kubernetes release operations                                      kubernetes  v0.28.0-dev  not installed
  management-cluster  Kubernetes management cluster operations                           kubernetes  v0.28.0-dev  not installed
  package             Tanzu package management                                           kubernetes  v0.28.0-dev  not installed
  secret              Tanzu secret management                                            kubernetes  v0.28.0-dev  not installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         kubernetes  v0.28.0-dev  not installed

I also rebased this PR on top of #45 and it works fine with a test Central Repository.

Release note

The "tanzu plugin search" command is added.  It is meant to be used to search for plugins that can be installed.

Additional information

This command is in its most basic form to be ready for a pre-alpha release.
It allows to list all discovered plugins without filtering.

Special notes for your reviewer

  • unit tests are missing but will be added in a follow-up PR

This commit provides the new "tanzu plugin search" command in its most
basic form:
- filtering is not yet supported
- listing versions is not yet supported

Signed-off-by: Marc Khouzam <kmarc@vmware.com>
Copy link
Contributor

@prkalle prkalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @marckhouzam!

@marckhouzam marckhouzam merged commit e57cea4 into vmware-tanzu:main Feb 3, 2023
@marckhouzam marckhouzam deleted the feat/centralPluginSearch branch February 3, 2023 02:36
@vuil vuil added the kind/feature Categorizes issue or PR as related to a new feature label Apr 7, 2023
@marckhouzam marckhouzam added this to the v0.90.0 milestone Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required kind/feature Categorizes issue or PR as related to a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants