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

Unify the plugin installation for standalone and context-scoped plugins and use context as recommendation #698

Merged
merged 10 commits into from
Apr 19, 2024

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Mar 13, 2024

What this PR does / why we need it

  • Unify the plugin installation for standalone and context-scoped plugins
  • Use context as a recommendation for which plugin/version to install
  • Updates the tanzu plugin install and tanzu plugin sync experience
  • Updates the tanzu plugin list output
  • Updates the tanzu plugin describe output

User facing changes:

  • Once a plugin is installed and plugin-specific commands are available, that plugin is always shown as installed and all plugin-related commands are available irrespective of whether the plugin was installed manually by the user with the tanzu plugin install command (standalone plugin) or it was installed automatically when the user created a context (context-scoped plugin).
    • Before this change, context-scoped plugins were getting removed once the corresponding context was deleted or unset.
    • After this change, the plugin's availability is mostly not dependent on whether a context is active or not, and even after the context gets deleted or unset, corresponding plugins are still available to the user to use.

Details:

tanzu plugin list:

  • Rename column from VERSION to INSTALLED.
  • Introduces a new column for recommended version based on active context called RECOMMENDED.
  • When a plugin is not recommended from an active context, the RECOMMENDED is left empty.
  • The RECOMMENDED column will be dynamic and will only be shown if at least one recommended version.
  • The STATUS column is used to show the installation and recommended status of the plugin considering the active context. Two new status values are added install recommended and update recommended.
  • Introduce a new flag --wide to view additional columns.
  • The ACTIVE column will be added to show if the plugin is active or not.
  • Update the tanzu plugin list --help to specify the meaning of INSTALLED and RECOMMENDED columns (TODO)

tanzu plugin sync

  • Use context-plugins as recommended plugins/versions and install all recommended plugins as standalone plugins.
  • As mentioned above, the STATUS column will be used to reflect the installation status.
  • When plugin sync is happening as part of the tanzu plugin sync or tanzu context create or tanzu context use command, a table will be shown with the INSTALLED and RECOMMENDED columns to show how the plugin is getting updated (install, upgrade, downgrade).

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

  • Initial plugin and context setup
~ $ tz plugin list
  NAME       DESCRIPTION                                                 TARGET  INSTALLED  STATUS
  telemetry  configure cluster-wide settings for vmware tanzu telemetry  global  v1.1.0     installed

~ $ tz context list
  NAME                   ISACTIVE  TYPE             PROJECT  SPACE
  cluster-1              false     kubernetes       n/a      n/a
  one-tanzu-integration  false     tanzu
  tmc                    false     mission-control  n/a      n/a

[i] Use '--wide' flag to view additional columns.
  • Install plugins with tz plugin install command and verify with tz plugin list
~ $ tz plugin install appsv2
[i] Installed plugin 'appsv2:v0.1.1-beta.2' with target 'kubernetes'
[ok] successfully installed 'appsv2' plugin

~ $ tz plugin install package
[i] Installed plugin 'package:v0.34.2' with target 'kubernetes'
[ok] successfully installed 'package' plugin

~ $ tz plugin list
  NAME       DESCRIPTION                                                 TARGET      INSTALLED      STATUS
  appsv2     Applications on Kubernetes for TAP (SaaS distribution)      kubernetes  v0.1.1-beta.2  installed
  package    tanzu package management                                    kubernetes  v0.34.2        installed
  telemetry  configure cluster-wide settings for vmware tanzu telemetry  global      v1.1.0         installed
  • Set the cluster-1 context as an active context that recommended some context-scoped plugins. Verify the installation and check the UX
~ $ tz context use cluster-1
[i] Successfully activated context 'cluster-1' of type 'kubernetes'.
[i] Fetching recommended plugins for active context 'cluster-1'...
[i] Installing following plugins recommended by the context 'cluster-1':
  NAME     TARGET      RECOMMENDED
  project  kubernetes  v0.1.0-build.4
  space    kubernetes  v0.1.0-build.5
[i] Installed plugin 'project:v0.1.0-build.4' with target 'kubernetes'
[i] Installed plugin 'space:v0.1.0-build.5' with target 'kubernetes'
[ok] Successfully installed all recommended plugins.

~ $ tz plugin list
  NAME       DESCRIPTION                                                 TARGET      INSTALLED       RECOMMENDED     STATUS
  appsv2     Applications on Kubernetes for TAP (SaaS distribution)      kubernetes  v0.1.1-beta.2                   installed
  package    tanzu package management                                    kubernetes  v0.34.2                         installed
  project    View, list and use Tanzu Projects.                          kubernetes  v0.1.0-build.4  v0.1.0-build.4  installed
  space      Tanzu space, space profile, and space trait management      kubernetes  v0.1.0-build.5  v0.1.0-build.5  installed
  telemetry  configure cluster-wide settings for vmware tanzu telemetry  global      v1.1.0                          installed
  • Manually Delete the project plugin and Install a different version of the space plugin that is not recommended by the active context. Verify the tz plugin list output.
~ $ tz plugin uninstall project -y
[i] Uninstalling plugin 'project' for target 'kubernetes'
[ok] successfully uninstalled plugin 'project'

~ $ tz plugin install space --version v0.1.0-alpha.1
[i] Installed plugin 'space:v0.1.0-alpha.1' with target 'kubernetes'
[ok] successfully installed 'space' plugin

~ $ tz plugin list
  NAME       DESCRIPTION                                                 TARGET      INSTALLED       RECOMMENDED     STATUS
  appsv2     Applications on Kubernetes for TAP (SaaS distribution)      kubernetes  v0.1.1-beta.2                   installed
  package    tanzu package management                                    kubernetes  v0.34.2                         installed
  project    View, list and use Tanzu Projects                           kubernetes                  v0.1.0-build.4  install recommended
  space      Tanzu space, space profile, and space trait management      kubernetes  v0.1.0-alpha.1  v0.1.0-build.5  update recommended
  telemetry  configure cluster-wide settings for vmware tanzu telemetry  global      v1.1.0                          installed

Note: As shown above, some recommended plugins have not been installed or are outdated. To install them please run 'tanzu plugin sync'.
  • Run tz plugin sync to install recommended version of the context-scoped plugins.
~ $ tz plugin sync
[i] Fetching recommended plugins for active context 'cluster-1'...
[i] Installing following plugins recommended by the context 'cluster-1':
  NAME     TARGET      INSTALLED       RECOMMENDED
  project  kubernetes                  v0.1.0-build.4
  space    kubernetes  v0.1.0-alpha.1  v0.1.0-build.5
[i] Installed plugin 'project:v0.1.0-build.4' with target 'kubernetes' (from cache)
[i] Installed plugin 'space:v0.1.0-build.5' with target 'kubernetes' (from cache)
[ok] Successfully installed all recommended plugins.

~ $ tz plugin list
  NAME       DESCRIPTION                                                 TARGET      INSTALLED       RECOMMENDED     STATUS
  appsv2     Applications on Kubernetes for TAP (SaaS distribution)      kubernetes  v0.1.1-beta.2                   installed
  package    tanzu package management                                    kubernetes  v0.34.2                         installed
  project    View, list and use Tanzu Projects.                          kubernetes  v0.1.0-build.4  v0.1.0-build.4  installed
  space      Tanzu space, space profile, and space trait management      kubernetes  v0.1.0-build.5  v0.1.0-build.5  installed
  telemetry  configure cluster-wide settings for vmware tanzu telemetry  global      v1.1.0                          installed
  • Activate tmc context that recommends additional context-scoped plugins.
~ $ tz context use tmc
[i] Successfully activated context 'tmc' of type 'mission-control'.
[i] Fetching recommended plugins for active context 'tmc'...
[i] Installing following plugins recommended by the context 'tmc':
  NAME                  TARGET           RECOMMENDED
  account               mission-control  v0.3.1
  agentartifacts        mission-control  v0.1.18
  aks-cluster           mission-control  v0.3.4
  apply                 mission-control  v0.3.17
  audit                 mission-control  v0.1.18
  cluster               mission-control  v0.2.14
  clustergroup          mission-control  v0.1.18
  context               mission-control  v0.1.13
  continuousdelivery    mission-control  v0.1.18
  data-protection       mission-control  v0.1.18
  ekscluster            mission-control  v0.2.3
  events                mission-control  v0.1.18
  helm                  mission-control  v0.1.19
  iam                   mission-control  v0.1.18
  inspection            mission-control  v0.1.18
  integration           mission-control  v0.1.18
  management-cluster    mission-control  v0.2.20
  policy                mission-control  v0.1.18
  provider-aks-cluster  mission-control  v0.1.20
  provider-eks-cluster  mission-control  v0.1.18
  secret                mission-control  v0.1.20
  setting               mission-control  v0.2.16
  tanzupackage          mission-control  v0.4.5
  workspace             mission-control  v0.1.20
[i] Installed plugin 'account:v0.3.1' with target 'mission-control'
[i] Installed plugin 'agentartifacts:v0.1.18' with target 'mission-control'
[i] Installed plugin 'aks-cluster:v0.3.4' with target 'mission-control'
[i] Installed plugin 'apply:v0.3.17' with target 'mission-control'
[i] Installed plugin 'audit:v0.1.18' with target 'mission-control'
[i] Installed plugin 'cluster:v0.2.14' with target 'mission-control'
[i] Installed plugin 'clustergroup:v0.1.18' with target 'mission-control'
[i] Installed plugin 'context:v0.1.13' with target 'mission-control'
[i] Installed plugin 'continuousdelivery:v0.1.18' with target 'mission-control'
[i] Installed plugin 'data-protection:v0.1.18' with target 'mission-control'
[i] Installed plugin 'ekscluster:v0.2.3' with target 'mission-control'
[i] Installed plugin 'events:v0.1.18' with target 'mission-control'
[i] Installed plugin 'helm:v0.1.19' with target 'mission-control'
[i] Installed plugin 'iam:v0.1.18' with target 'mission-control'
[i] Installed plugin 'inspection:v0.1.18' with target 'mission-control'
[i] Installed plugin 'integration:v0.1.18' with target 'mission-control'
[i] Installed plugin 'management-cluster:v0.2.20' with target 'mission-control'
[i] Installed plugin 'policy:v0.1.18' with target 'mission-control'
[i] Installed plugin 'provider-aks-cluster:v0.1.20' with target 'mission-control'
[i] Installed plugin 'provider-eks-cluster:v0.1.18' with target 'mission-control'
[i] Installed plugin 'secret:v0.1.20' with target 'mission-control'
[i] Installed plugin 'setting:v0.2.16' with target 'mission-control'
[i] Installed plugin 'tanzupackage:v0.4.5' with target 'mission-control'
[i] Installed plugin 'workspace:v0.1.20' with target 'mission-control'
[ok] Successfully installed all recommended plugins.


~ $ tz plugin list
  NAME                  DESCRIPTION                                                                       TARGET           INSTALLED       RECOMMENDED     STATUS
  account               TMC account management for the organization                                       mission-control  v0.3.1          v0.3.1          installed
  agentartifacts        Image artifacts of all the agents to be made available on the cluster             mission-control  v0.1.18         v0.1.18         installed
  aks-cluster           aks-cluster plugin is used to provision and manage the tmc aks clusters.          mission-control  v0.3.4          v0.3.4          installed
  apply                 Apply a resource file                                                             mission-control  v0.3.17         v0.3.17         installed
  appsv2                Applications on Kubernetes for TAP (SaaS distribution)                            kubernetes       v0.1.1-beta.2                   installed
  audit                 Run an audit request on an organization                                           mission-control  v0.1.18         v0.1.18         installed
  cluster               A TMC managed Kubernetes cluster                                                  mission-control  v0.2.14         v0.2.14         installed
  clustergroup          A group of Kubernetes clusters                                                    mission-control  v0.1.18         v0.1.18         installed
  context               Management for TMC contexts                                                       mission-control  v0.1.13         v0.1.13         installed
  continuousdelivery    Manage cluster configurations                                                     mission-control  v0.1.18         v0.1.18         installed
  data-protection       Backup, restore, or migrate cluster data.                                         mission-control  v0.1.18         v0.1.18         installed
  ekscluster            ekscluster plugin is used to provision and manage the tmc eks clusters.           mission-control  v0.2.3          v0.2.3          installed
  events                TMC events for any meaningful user activity or system state change                mission-control  v0.1.18         v0.1.18         installed
  helm                  Manage helm deployments                                                           mission-control  v0.1.19         v0.1.19         installed
  iam                   IAM Policies for tmc resources                                                    mission-control  v0.1.18         v0.1.18         installed
  inspection            Run an inspection on a cluster                                                    mission-control  v0.1.18         v0.1.18         installed
  integration           Get available integrations and their information from registry.                   mission-control  v0.1.18         v0.1.18         installed
  management-cluster    A TMC registered Management cluster                                               mission-control  v0.2.20         v0.2.20         installed
  package               tanzu package management                                                          kubernetes       v0.34.2                         installed
  policy                Policy management for resources                                                   mission-control  v0.1.18         v0.1.18         installed
  project               View, list and use Tanzu Projects.                                                kubernetes       v0.1.0-build.4  v0.1.0-build.4  installed
  provider-aks-cluster  provider-aks-cluster plugin is used to manage and unmanage tmc provider aks       mission-control  v0.1.20         v0.1.20         installed
                        clusters
  provider-eks-cluster  provider-eks-cluster plugin is used to manage and unmanage tmc provider eks       mission-control  v0.1.18         v0.1.18         installed
                        clusters
  secret                Manage kubernetes secrets resource for a cluster                                  mission-control  v0.1.20         v0.1.20         installed
  setting               Manage default settings for some tmc features                                     mission-control  v0.2.16         v0.2.16         installed
  space                 Tanzu space, space profile, and space trait management                            kubernetes       v0.1.0-build.5  v0.1.0-build.5  installed
  tanzupackage          Install and manage Tanzu packages. Note: tanzu-standard package repository is     mission-control  v0.4.5          v0.4.5          installed
                        unavailable for non-TKG clusters.
  telemetry             configure cluster-wide settings for vmware tanzu telemetry                        global           v1.1.0                          installed
  workspace             A group of Kubernetes namespaces                                                  mission-control  v0.1.20         v0.1.20         installed
  • Unset the context and notice that plugins are still present and available
~ $ tz context unset tmc
The context 'tmc' of type 'mission-control' has been set as inactive


~ $ tz plugin list
  NAME                  DESCRIPTION                                                                       TARGET           INSTALLED       RECOMMENDED     STATUS
  account               TMC account management for the organization                                       mission-control  v0.3.1                          installed
  agentartifacts        Image artifacts of all the agents to be made available on the cluster             mission-control  v0.1.18                         installed
  aks-cluster           aks-cluster plugin is used to provision and manage the tmc aks clusters.          mission-control  v0.3.4                          installed
  apply                 Apply a resource file                                                             mission-control  v0.3.17                         installed
  appsv2                Applications on Kubernetes for TAP (SaaS distribution)                            kubernetes       v0.1.1-beta.2                   installed
  audit                 Run an audit request on an organization                                           mission-control  v0.1.18                         installed
  cluster               A TMC managed Kubernetes cluster                                                  mission-control  v0.2.14                         installed
  clustergroup          A group of Kubernetes clusters                                                    mission-control  v0.1.18                         installed
  context               Management for TMC contexts                                                       mission-control  v0.1.13                         installed
  continuousdelivery    Manage cluster configurations                                                     mission-control  v0.1.18                         installed
  data-protection       Backup, restore, or migrate cluster data.                                         mission-control  v0.1.18                         installed
  ekscluster            ekscluster plugin is used to provision and manage the tmc eks clusters.           mission-control  v0.2.3                          installed
  events                TMC events for any meaningful user activity or system state change                mission-control  v0.1.18                         installed
  helm                  Manage helm deployments                                                           mission-control  v0.1.19                         installed
  iam                   IAM Policies for tmc resources                                                    mission-control  v0.1.18                         installed
  inspection            Run an inspection on a cluster                                                    mission-control  v0.1.18                         installed
  integration           Get available integrations and their information from registry.                   mission-control  v0.1.18                         installed
  management-cluster    A TMC registered Management cluster                                               mission-control  v0.2.20                         installed
  package               tanzu package management                                                          kubernetes       v0.34.2                         installed
  policy                Policy management for resources                                                   mission-control  v0.1.18                         installed
  project               View, list and use Tanzu Projects.                                                kubernetes       v0.1.0-build.4  v0.1.0-build.4  installed
  provider-aks-cluster  provider-aks-cluster plugin is used to manage and unmanage tmc provider aks       mission-control  v0.1.20                         installed
                        clusters
  provider-eks-cluster  provider-eks-cluster plugin is used to manage and unmanage tmc provider eks       mission-control  v0.1.18                         installed
                        clusters
  secret                Manage kubernetes secrets resource for a cluster                                  mission-control  v0.1.20                         installed
  setting               Manage default settings for some tmc features                                     mission-control  v0.2.16                         installed
  space                 Tanzu space, space profile, and space trait management                            kubernetes       v0.1.0-build.5  v0.1.0-build.5  installed
  tanzupackage          Install and manage Tanzu packages. Note: tanzu-standard package repository is     mission-control  v0.4.5                          installed
                        unavailable for non-TKG clusters.
  telemetry             configure cluster-wide settings for vmware tanzu telemetry                        global           v1.1.0                          installed
  workspace             A group of Kubernetes namespaces                                                  mission-control  v0.1.20                         installed

Release note

Updates to `tanzu plugin list`, and `tanzu plugin sync` user experience. All plugins are installed as standalone plugins.

Additional information

Special notes for your reviewer

@anujc25 anujc25 requested a review from a team as a code owner March 13, 2024 00:15
@anujc25 anujc25 force-pushed the install-context-plugins-as-standalone-plugins-v3 branch 2 times, most recently from 5d2df69 to 3f7ce7e Compare March 13, 2024 16:31
go.mod Outdated Show resolved Hide resolved
@anujc25 anujc25 force-pushed the install-context-plugins-as-standalone-plugins-v3 branch from 3f7ce7e to 6b87894 Compare April 1, 2024 14:27
@anujc25 anujc25 force-pushed the install-context-plugins-as-standalone-plugins-v3 branch from 0d4bf7f to 58effbc Compare April 9, 2024 19:40
Comment on lines +18 to +21
// Migrate context-scoped plugins as standalone plugin if required
// TODO(anujc): Think on how to invoke this function just once after the newer version
// of the CLI gets installed as we just need to do this migration once
catalog.MigrateContextPluginsAsStandaloneIfNeeded()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#723 can be useful for this situation.

@anujc25 anujc25 force-pushed the install-context-plugins-as-standalone-plugins-v3 branch from ba87e83 to f34fbc6 Compare April 17, 2024 15:13
Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

I like this new approach! Thanks for pushing for this @anujc25.
I'm about half way through the review, but here are some minor comments to get started, since we are pressed for time.

pkg/command/plugin.go Show resolved Hide resolved
pkg/command/plugin.go Show resolved Hide resolved
pkg/command/plugin.go Show resolved Hide resolved
pkg/command/plugin.go Show resolved Hide resolved
pkg/command/plugin.go Outdated Show resolved Hide resolved
pkg/common/constants.go Outdated Show resolved Hide resolved
pkg/pluginmanager/manager.go Show resolved Hide resolved
pkg/pluginmanager/manager.go Outdated Show resolved Hide resolved
pkg/command/context.go Outdated Show resolved Hide resolved
pkg/command/context.go Outdated Show resolved Hide resolved
pkg/command/context.go Outdated Show resolved Hide resolved
pkg/command/context.go Outdated Show resolved Hide resolved
pkg/pluginsupplier/plugin_supplier.go Show resolved Hide resolved
Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

I finished the review.
I like this. A lot. My first impression as a user is that it makes things much simpler.
Here are my last comments. Again, minor.
Beautiful job, as usual, @anujc25 .

  1. From the jira, this was not done: "Update tanzu plugin list --help to specify the meaning of INSTALLED and RECOMMENDED columns". But to be honest, I think the meaning is pretty clear without needing any explanation, so would leave it alone.
  2. On the other hand, it is only when I saw the code that I understood what the ACTIVE column really meant. Until then I thought it was a short form of installed vs not installed. I think this needs to be described, maybe in the help.
  3. The status "update recommended" should be "upgrade recommended" I think. The command we have is tanzu plugin upgrade. Also, for package managers, update is used to get the latest info while upgrade is used to install a new version.
  4. Am I right that in a future effort, we can cleanup the logic of the catalog to no longer deal with context plugins?
  5. For discussion for a potential follow-up:
    I was about to delete this comment, but then I thought that when a user sees "install recommended" or "update recommended" in the plugin list output, they may just try tanzu plugin install <plugin>. The below would address this scenario.
    What if, when doing plugin install <plugin> with no version specified, instead of always using the latest we would use the recommended version? One could argue that if a version is recommended, that is what should be installed with plugin install. We could also not require the --target flag if only one plugin with a name is recommended but not installed.

Below are some thoughts that I'd like to discuss with you. I'm not sure any of them are good ideas or not.

A- In plugin list, in the RECOMMENDED column, should we put "N/A" or "none" or something like that for plugins that are not currently recommended?

B- In plugin list, I was wondering about the sorting. Would it be nicer to sort uninstalled plugins at the end, or maybe even better sorting by the STATUS colum so plugins that need a sync (to install or upgrade) are shown at the bottom?

C- When synching plugins (plugin sync, context create/use) I find the column names a bit confusing:

$ tz context use tkg3
[i] Activated context 'tkg3' (Type: kubernetes)
[i] Fetching recommended plugins for active context 'tkg3'...
[i] Installing following plugins recommended by the context 'tkg3':
  NAME     TARGET      INSTALLED  RECOMMENDED
  cluster  kubernetes  v0.33.1    v0.25.0
[i] Installed plugin 'cluster:v0.25.0' with target 'kubernetes' (from cache)

Does INSTALLED mean what was just installed or what was previously installed? Does RECOMMENDED mean it will be installed or it SHOULD be installed? Not a big problem with the message right below saying "[i] Installed plugin 'cluster:v0.25.0'", however it will become a bigger problem when we use a spinner and that line is erased quickly. How about using "CURRENT" and "INSTALLING"?

D- I'm getting used to the empty INSTALLED column meaning "not installed", but at the beginning it was not totally obvious, especially since we don't use "not installed" but "install recommended" (which I like). So I'm wondering if we should put "none" instead of empty? But I'm not sure at all to be honest.

E- When I unset a context, do I need a way to uninstall the corresponding context plugins? I'm starting to see that keeping them is probably easier to understand for users, but what will they do if they want to remove them once they get rid of a context that is using plugins that have been abandoned? Rare case probably. I think we should consider to eventually (not this PR) provide a way to do a cleanup. Maybe a plugin clean that does not wipe the cache.

Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

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

Added another minor comment.

As far as documenting the user facing impact of the changes, besides updating PR description,

  • there are some existing md that should be updated (e.g. quickstart.md)
  • we should mention that what commands are available to the user is mostly not dependent on whether a context is active or not anymore
  • the release notes need to be updated with a short summary of the changes including the previous point
  • "docs-impact" label should be added

pkg/command/plugin.go Show resolved Hide resolved
@anujc25 anujc25 added the docs-impact issues with documentation impact label Apr 18, 2024
@anujc25 anujc25 force-pushed the install-context-plugins-as-standalone-plugins-v3 branch from 2c9b537 to fb57491 Compare April 18, 2024 18:46
- Update error and warning messages
- Add contextName as part of the `tanzu plugin list` for json/yaml output when
  plugin is recommended
- Add comment to the IsPluginActive function
- Hide `--wide` flag for `tanzu plugin list`
- Update status to `update needed` and `not installed` instead of
  `update recommended` and `install recommeneded` respectively
- Update column names for the to be installed plugins table when running
  `tanzu plugin sync` and `tanzu context use/create` to show `CURRENT`
  and `INSTALLING`.
@anujc25 anujc25 force-pushed the install-context-plugins-as-standalone-plugins-v3 branch from fb57491 to c1b34e2 Compare April 18, 2024 19:13
@anujc25
Copy link
Contributor Author

anujc25 commented Apr 18, 2024

Thanks, @marckhouzam @vuil for the review and feedback. I am updating based on what we discussed in our meeting.

Adding some details here based on what we discussed during our meeting.

  1. On the other hand, it is only when I saw the code that I understood what the ACTIVE column really meant. Until then I thought it was a short form of installed vs not installed. I think this needs to be described, maybe in the help.

We decided to hide the --wide flag for tanzu plugin list as it will be mainly used for debugging purpose for now and users should not need to know about the ACTIVE column at the moment.

  1. The status "update recommended" should be "upgrade recommended" I think. The command we have is tanzu plugin upgrade. Also, for package managers, update is used to get the latest info while upgrade is used to install a new version.

Because there is a chance that when switching the context user might want to downgrade a plugin as well, we decided to use update here.

  1. Am I right that in a future effort, we can cleanup the logic of the catalog to no longer deal with context plugins?

Yes. I will fill an issue to track this.

  1. For discussion for a potential follow-up:
    I was about to delete this comment, but then I thought that when a user sees "install recommended" or "update recommended" in the plugin list output, they may just try tanzu plugin install <plugin>. The below would address this scenario.
    What if, when doing plugin install <plugin> with no version specified, instead of always using the latest we would use the recommended version? One could argue that if a version is recommended, that is what should be installed with plugin install. We could also not require the --target flag if only one plugin with a name is recommended but not installed.

+1 Good point. I will file an issue to track this enhancement.

Below are some thoughts that I'd like to discuss with you. I'm not sure any of them are good ideas or not.

A- In plugin list, in the RECOMMENDED column, should we put "N/A" or "none" or something like that for plugins that are not currently recommended?

We decided to keep it empty as it is.

B- In plugin list, I was wondering about the sorting. Would it be nicer to sort uninstalled plugins at the end, or maybe even better sorting by the STATUS colum so plugins that need a sync (to install or upgrade) are shown at the bottom?

We decided to keep it sorted by names for now.

C- When synching plugins (plugin sync, context create/use) I find the column names a bit confusing:

Agreed. Updated PR to address this.

D- I'm getting used to the empty INSTALLED column meaning "not installed", but at the beginning it was not totally obvious, especially since we don't use "not installed" but "install recommended" (which I like). So I'm wondering if we should put "none" instead of empty? But I'm not sure at all to be honest.

We decided to use empty columns for this one.

E- When I unset a context, do I need a way to uninstall the corresponding context plugins? I'm starting to see that keeping them is probably easier to understand for users, but what will they do if they want to remove them once they get rid of a context that is using plugins that have been abandoned? Rare case probably. I think we should consider to eventually (not this PR) provide a way to do a cleanup. Maybe a plugin clean that does not wipe the cache.

We might have to think about this but it might not be based on the context but can do something similar in different ways. But we decided to not do anything for this PR.

@anujc25 anujc25 force-pushed the install-context-plugins-as-standalone-plugins-v3 branch 2 times, most recently from a6d6769 to b971e9d Compare April 18, 2024 22:00
@anujc25 anujc25 force-pushed the install-context-plugins-as-standalone-plugins-v3 branch from b971e9d to bf1a211 Compare April 18, 2024 22:17
go.work.sum Outdated Show resolved Hide resolved
Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

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

Minor nits and a env var rename recommendation, feel free to ignore.
lgtm, you might want to wait for @marckhouzam's approval as well.

docs/full/context-recommended-plugins.md Outdated Show resolved Hide resolved
docs/plugindev/README.md Outdated Show resolved Hide resolved
docs/plugindev/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for your effort and patience. This will simplify things for users and ourselves.

Summarizing the follow-ups that I noticed:

  1. remove ConfigVariableStandaloneOverContextPlugins
  2. use a global initializer to migrate the catalog
  3. clean up the catalog to no longer support context plugins
  4. tanzu plugin install <plugin> would not install the latest but would install the recommended version if there is one

@anujc25 anujc25 merged commit 0966881 into main Apr 19, 2024
9 checks passed
vuil pushed a commit to vuil/tanzu-cli that referenced this pull request Apr 19, 2024
…ns and use context as recommendation (vmware-tanzu#698)

- Unify the plugin installation for standalone and context-scoped plugins
- Use context as a recommendation for which plugin/version to install
- Updates the tanzu plugin install and tanzu plugin sync experience
- Updates the tanzu plugin list output
- Updates the tanzu plugin describe output

User facing changes:

- Once a plugin is installed and plugin-specific commands are available, that plugin is always shown as installed and all plugin-related commands are available irrespective of whether the plugin was installed manually by the user with the tanzu plugin install command (standalone plugin) or it was installed automatically when the user created a context (context-scoped plugin).
- Before this change, context-scoped plugins were getting removed once the corresponding context was deleted or unset.
- After this change, the plugin's availability is mostly not dependent on whether a context is active or not, and even after the context gets deleted or unset, corresponding plugins are still available to the user to use.
vuil pushed a commit that referenced this pull request Apr 19, 2024
…ns and use context as recommendation (#698)

- Unify the plugin installation for standalone and context-scoped plugins
- Use context as a recommendation for which plugin/version to install
- Updates the tanzu plugin install and tanzu plugin sync experience
- Updates the tanzu plugin list output
- Updates the tanzu plugin describe output

User facing changes:

- Once a plugin is installed and plugin-specific commands are available, that plugin is always shown as installed and all plugin-related commands are available irrespective of whether the plugin was installed manually by the user with the tanzu plugin install command (standalone plugin) or it was installed automatically when the user created a context (context-scoped plugin).
- Before this change, context-scoped plugins were getting removed once the corresponding context was deleted or unset.
- After this change, the plugin's availability is mostly not dependent on whether a context is active or not, and even after the context gets deleted or unset, corresponding plugins are still available to the user to use.
@marckhouzam marckhouzam added this to the v1.3.0 milestone Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required docs-impact issues with documentation impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants