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

Cleanup the use of feature flags (except for the plugin manager) #482

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

marckhouzam
Copy link
Contributor

@marckhouzam marckhouzam commented Sep 15, 2023

What this PR does / why we need it

The CLI does not support turning off the Central Repository feature. Therefore, the current feature flag constants.FeatureDisableCentralRepositoryForTesting cannot be used, and its unused code paths should be removed.

The same goes for the constants.FeatureContextCommand feature flag. However, for this one, a more complete cleanup is required before removing it from unit tests, as it is off by default for unit tests and requires the unit tests to enable it. I will post a separate PR for this cleanup. The use of this feature flag can be removed from normal code (not unit tests) and has been done in this PR (except for the plugin manager, which will come in a separate PR also).

This commit removes the code that was no longer run due to feature flags not being supported anymore. The unit tests are also updated to match this reality.

Furthermore, now that we don't support turning off the Central repo of plugins feature, the only OCI discovery that is supported is the DBBackedOCIDiscovery, so this commit removes the OCIDiscovery type and its supporting code.

Which issue(s) this PR fixes

Part of #477

Describe testing done for PR

Ran make test locally successfully.

$ rm ~/.config/tanzu/config*
$ tz ceip set false
$ tz config eula accept
[ok] Marking agreement as accepted.


# For "plugin install" check the flags "--local", "--local-source", "group"
$ tz plugin install -h
Install a specific plugin by name or specify all to install all plugins of a group

Usage:
tanzu plugin install [PLUGIN_NAME] [flags]

Examples:

    # Install all plugins of the vmware-tkg/default plugin group version v2.1.0
    tanzu plugin install --group vmware-tkg/default:v2.1.0

    # Install all plugins of the latest version of the vmware-tkg/default plugin group
    tanzu plugin install --group vmware-tkg/default

    # Install the latest version of plugin "myPlugin"
    # If the plugin exists for more than one target, an error will be thrown
    tanzu plugin install myPlugin

    # Install the latest version of plugin "myPlugin" for target kubernetes
    tanzu plugin install myPlugin --target k8s

    # Install version v1.0.0 of plugin "myPlugin"
    tanzu plugin install myPlugin --version v1.0.0

Flags:
      --group string     install the plugins specified by a plugin-group version
  -h, --help             help for install
  -t, --target string    target of the plugin (kubernetes[k8s]/mission-control[tmc]/global)
  -v, --version string   version of the plugin (default "latest")

$ tz plugin install
[x] : missing plugin name as an argument or the use of '--group'

$ tz plugin install --local test
Flag --local has been deprecated, this was done in the v1.0.0 release, it will be removed following the deprecation policy (6 months). Use the --local-source flag instead.

[x] : missing plugin name or 'all' as an argument

$ tz plugin install --local-source test
[x] : missing plugin name or 'all' as an argument

$ # Check mutual exclusiveness of flags
$ tz plugin install --group test --local-source test
[x] : if any flags in the group [group local-source] are set none of the others can be; [group local-source] were all set
$ tz plugin install --group test --local test
Flag --local has been deprecated, this was done in the v1.0.0 release, it will be removed following the deprecation policy (6 months). Use the --local-source flag instead.

[x] : if any flags in the group [group local] are set none of the others can be; [group local] were all set
$ tz plugin install --group test --target test
[x] : if any flags in the group [group target] are set none of the others can be; [group target] were all set
$ tz plugin install --group test --version test
[x] : if any flags in the group [group version] are set none of the others can be; [group version] were all set

$ # check presence of --target flag for the different plugin commands
$ tz plugin install --target
[x] : flag needs an argument: --target
$ tz plugin delete --target
[x] : flag needs an argument: --target
$ tz plugin upgrade --target
[x] : flag needs an argument: --target
$ tz plugin describe --target
[x] : flag needs an argument: --target

$ # Check the presence of all plugin subcommands
$ tz plugin -h
Provides all lifecycle operations for plugins

Usage:
  tanzu plugin [command]

Available Commands:
  clean           Clean the plugins
  delete          Delete a plugin
  describe        Describe a plugin
  download-bundle Download plugin bundle to the local system
  group           Manage plugin-groups
  install         Install a plugin
  list            List installed plugins
  search          Search for available plugins
  source          Manage plugin discovery sources
  sync            Installs all plugins recommended by the active contexts
  upgrade         Upgrade a plugin
  upload-bundle   Upload plugin bundle to a repository

Flags:
  -h, --help   help for plugin

Use "tanzu plugin [command] --help" for more information about a command.

$ # Check the args bounds for "plugin install"
$ tz plugin install
[x] : missing plugin name as an argument or the use of '--group'
$ tz plugin install hello friend
[x] : accepts at most 1 arg(s), received 2

# Install some plugins 
$ tz plugin install --group vmware-tkg/default
[i] Installing plugin 'isolated-cluster:v0.30.1' with target 'global'
[i] Plugin binary for 'isolated-cluster:v0.30.1' found in cache
[i] Installing plugin 'management-cluster:v0.30.1' with target 'kubernetes'
[i] Installing plugin 'package:v0.30.1' with target 'kubernetes'
[i] Plugin binary for 'package:v0.30.1' found in cache
[i] Installing plugin 'pinniped-auth:v0.30.1' with target 'global'
[i] Installing plugin 'secret:v0.30.1' with target 'kubernetes'
[i] Installing plugin 'telemetry:v0.30.1' with target 'kubernetes'
[ok] successfully installed all plugins from group 'vmware-tkg/default:v2.3.0'

# Check plugin list
$ tz plugin list
Standalone Plugins
  NAME                DESCRIPTION                                                        TARGET      VERSION  STATUS
  isolated-cluster    Prepopulating images/bundle for internet-restricted environments   global      v0.30.1  installed
  pinniped-auth       Pinniped authentication operations (usually not directly invoked)  global      v0.30.1  installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         global      v1.1.0   installed
  management-cluster  Kubernetes management cluster operations                           kubernetes  v0.30.1  installed
  package             Tanzu package management                                           kubernetes  v0.30.1  installed
  secret              Tanzu secret management                                            kubernetes  v0.30.1  installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         kubernetes  v0.30.1  installed

# Install context plugins
$ tz context create tkg1 --kubecontext k3d-tkg1 --kubeconfig /Users/kmarc/.k3d/kubeconfig-tkg1.yaml
[ok] successfully created a kubernetes context using the kubeconfig /Users/kmarc/.k3d/kubeconfig-tkg1.yaml
[i] Checking for required plugins...
[i] Installing plugin 'cluster:v0.30.1' with target 'kubernetes'
[i] Plugin binary for 'cluster:v0.30.1' found in cache
[i] Installing plugin 'kubernetes-release:v0.30.1' with target 'kubernetes'
[i] Plugin binary for 'kubernetes-release:v0.30.1' found in cache
[i] Installing plugin 'feature:v0.30.1' with target 'kubernetes'
[i] Plugin binary for 'feature:v0.30.1' found in cache
[i] Successfully installed all required plugins

# Check plugin list
$ tz plugin list
Standalone Plugins
  NAME                DESCRIPTION                                                        TARGET      VERSION  STATUS
  isolated-cluster    Prepopulating images/bundle for internet-restricted environments   global      v0.30.1  installed
  pinniped-auth       Pinniped authentication operations (usually not directly invoked)  global      v0.30.1  installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         global      v1.1.0   installed
  management-cluster  Kubernetes management cluster operations                           kubernetes  v0.30.1  installed
  package             Tanzu package management                                           kubernetes  v0.30.1  installed
  secret              Tanzu secret management                                            kubernetes  v0.30.1  installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         kubernetes  v0.30.1  installed

Plugins from Context:  tkg1
  NAME                DESCRIPTION                           TARGET      VERSION  STATUS
  cluster             Kubernetes cluster operations         kubernetes  v0.30.1  installed
  feature             Operate on features and featuregates  kubernetes  v0.30.1  installed
  kubernetes-release  Kubernetes release operations         kubernetes  v0.30.1  installed

# Install context plugins for tmc
$ tz context create tmc --endpoint unstable.tmc-dev.cloud.vmware.com --staging

[i] 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 ****************************************************************

[ok] successfully created a TMC context
[i] Checking for required plugins...
[i] Installing plugin 'apply:v0.3.0' with target 'mission-control'
[i] Installing plugin 'cluster:v0.1.6' with target 'mission-control'
[i] Installing plugin 'agentartifacts:v0.1.3' with target 'mission-control'
^C

# Check plugin list
$ tz plugin list
Standalone Plugins
  NAME                DESCRIPTION                                                        TARGET      VERSION  STATUS
  isolated-cluster    Prepopulating images/bundle for internet-restricted environments   global      v0.30.1  installed
  pinniped-auth       Pinniped authentication operations (usually not directly invoked)  global      v0.30.1  installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         global      v1.1.0   installed
  management-cluster  Kubernetes management cluster operations                           kubernetes  v0.30.1  installed
  package             Tanzu package management                                           kubernetes  v0.30.1  installed
  secret              Tanzu secret management                                            kubernetes  v0.30.1  installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         kubernetes  v0.30.1  installed

Plugins from Context:  tkg1
  NAME                DESCRIPTION                           TARGET      VERSION  STATUS
  cluster             Kubernetes cluster operations         kubernetes  v0.30.1  installed
  feature             Operate on features and featuregates  kubernetes  v0.30.1  installed
  kubernetes-release  Kubernetes release operations         kubernetes  v0.30.1  installed

Plugins from Context:  tmc
  NAME                  DESCRIPTION                                                     TARGET           VERSION  STATUS
  account               Account for tmc resources                                       mission-control  v0.1.3   not installed
  agentartifacts        helm for tmc resources                                          mission-control  v0.1.3   not installed
  aks-cluster           Manage and unmanage tmc aks clusters                            mission-control  v0.1.6   not installed
  apply                 Create/Update a resource with a resource file                   mission-control  v0.3.0   installed
  audit                 Run an audit request on an org                                  mission-control  v0.1.3   not installed
  cluster                                                                               mission-control  v0.1.6   installed
  clustergroup          A group of Kubernetes clusters                                  mission-control  v0.1.3   not installed
  continuousdelivery    Continuousdelivery for tmc resources                            mission-control  v0.1.3   not installed
  data-protection       Data protection for tmc resources                               mission-control  v0.1.3   not installed
  ekscluster                                                                            mission-control  v0.1.3   not installed
  events                Events for any meaningful user activity or system state change  mission-control  v0.1.3   not installed
  helm                  helm for tmc resources                                          mission-control  v0.1.3   not installed
  iam                   IAM Policies for tmc resources                                  mission-control  v0.1.3   not installed
  inspection            Inspection for tmc resources                                    mission-control  v0.1.3   not installed
  integration           Get available integrations and their information from registry  mission-control  v0.1.3   not installed
  management-cluster    A TMC registered Management cluster                             mission-control  v0.1.3   not installed
  policy                Policy for tmc resources                                        mission-control  v0.1.3   not installed
  provider-aks-cluster  Manage and unmanage tmc provider aks clusters                   mission-control  v0.1.3   not installed
  provider-eks-cluster                                                                  mission-control  v0.1.3   not installed
  secret                secret for tmc resources                                        mission-control  v0.1.3   not installed
  setting               Setting plugin for tmc resources                                mission-control  v0.2.1   not installed
  tanzupackage          Tanzupackage for tmc resources                                  mission-control  v0.2.2   not installed
  workspace             A group of Kubernetes namespaces                                mission-control  v0.1.5   not installed

[!] As shown above, some recommended plugins have not been installed or are outdated. To install them please run 'tanzu plugin sync'.

$ tz plugin list --output json
[
  {
    "context": "",
    "description": "Prepopulating images/bundle for internet-restricted environments",
    "name": "isolated-cluster",
    "status": "installed",
    "target": "global",
    "version": "v0.30.1"
  },
  {
    "context": "",
    "description": "Pinniped authentication operations (usually not directly invoked)",
    "name": "pinniped-auth",
    "status": "installed",
    "target": "global",
    "version": "v0.30.1"
  },
  {
    "context": "",
    "description": "configure cluster-wide settings for vmware tanzu telemetry",
    "name": "telemetry",
    "status": "installed",
    "target": "global",
    "version": "v1.1.0"
  },
  {
    "context": "",
    "description": "Applications on Kubernetes",
    "name": "apps",
    "status": "installed",
    "target": "kubernetes",
    "version": "v0.11.1"
  },
  {
    "context": "",
    "description": "Kubernetes management cluster operations",
    "name": "management-cluster",
    "status": "installed",
    "target": "kubernetes",
    "version": "v0.30.1"
  },
  {
    "context": "",
    "description": "Tanzu package management",
    "name": "package",
    "status": "installed",
    "target": "kubernetes",
    "version": "v0.30.1"
  },
  {
    "context": "",
    "description": "Tanzu secret management",
    "name": "secret",
    "status": "installed",
    "target": "kubernetes",
    "version": "v0.30.1"
  },
  {
    "context": "",
    "description": "configure cluster-wide settings for vmware tanzu telemetry",
    "name": "telemetry",
    "status": "installed",
    "target": "kubernetes",
    "version": "v0.30.1"
  },
  {
    "context": "tkg1",
    "description": "Kubernetes cluster operations",
    "name": "cluster",
    "status": "installed",
    "target": "kubernetes",
    "version": "v0.30.1"
  },
  {
    "context": "tkg1",
    "description": "Operate on features and featuregates",
    "name": "feature",
    "status": "installed",
    "target": "kubernetes",
    "version": "v0.30.1"
  },
  {
    "context": "tkg1",
    "description": "Kubernetes release operations",
    "name": "kubernetes-release",
    "status": "installed",
    "target": "kubernetes",
    "version": "v0.30.1"
  },
  {
    "context": "tmc",
    "description": "Create/Update a resource with a resource file",
    "name": "apply",
    "status": "installed",
    "target": "mission-control",
    "version": "v0.3.0"
  },
  {
    "context": "tmc",
    "description": "",
    "name": "cluster",
    "status": "installed",
    "target": "mission-control",
    "version": "v0.1.6"
  },
  {
    "context": "tmc",
    "description": "Account for tmc resources",
    "name": "account",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "helm for tmc resources",
    "name": "agentartifacts",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Manage and unmanage tmc aks clusters",
    "name": "aks-cluster",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.6"
  },
  {
    "context": "tmc",
    "description": "Run an audit request on an org",
    "name": "audit",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "A group of Kubernetes clusters",
    "name": "clustergroup",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Continuousdelivery for tmc resources",
    "name": "continuousdelivery",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Data protection for tmc resources",
    "name": "data-protection",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "",
    "name": "ekscluster",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Events for any meaningful user activity or system state change",
    "name": "events",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "helm for tmc resources",
    "name": "helm",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "IAM Policies for tmc resources",
    "name": "iam",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Inspection for tmc resources",
    "name": "inspection",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Get available integrations and their information from registry",
    "name": "integration",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "A TMC registered Management cluster",
    "name": "management-cluster",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Policy for tmc resources",
    "name": "policy",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Manage and unmanage tmc provider aks clusters",
    "name": "provider-aks-cluster",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "",
    "name": "provider-eks-cluster",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "secret for tmc resources",
    "name": "secret",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.3"
  },
  {
    "context": "tmc",
    "description": "Setting plugin for tmc resources",
    "name": "setting",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.2.1"
  },
  {
    "context": "tmc",
    "description": "Tanzupackage for tmc resources",
    "name": "tanzupackage",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.2.2"
  },
  {
    "context": "tmc",
    "description": "A group of Kubernetes namespaces",
    "name": "workspace",
    "status": "not installed",
    "target": "mission-control",
    "version": "v0.1.5"
  }
]%

# Install an individual plugin with default version
$ tz plugin install apps
[i] Installing plugin 'apps:v0.12.1' with target 'kubernetes'
[ok] successfully installed 'apps' plugin

$ tz plugin list
Standalone Plugins
  NAME                DESCRIPTION                                                        TARGET      VERSION  STATUS
  isolated-cluster    Prepopulating images/bundle for internet-restricted environments   global      v0.30.1  installed
  pinniped-auth       Pinniped authentication operations (usually not directly invoked)  global      v0.30.1  installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         global      v1.1.0   installed
  apps                Applications on Kubernetes                                         kubernetes  v0.12.1  installed
  management-cluster  Kubernetes management cluster operations                           kubernetes  v0.30.1  installed
  package             Tanzu package management                                           kubernetes  v0.30.1  installed
  secret              Tanzu secret management                                            kubernetes  v0.30.1  installed
  telemetry           configure cluster-wide settings for vmware tanzu telemetry         kubernetes  v0.30.1  installed

Plugins from Context:  tkg1
  NAME                DESCRIPTION                           TARGET      VERSION  STATUS
  cluster             Kubernetes cluster operations         kubernetes  v0.30.1  installed
  feature             Operate on features and featuregates  kubernetes  v0.30.1  installed
  kubernetes-release  Kubernetes release operations         kubernetes  v0.30.1  installed

Plugins from Context:  tmc
  NAME                  DESCRIPTION                                                     TARGET           VERSION  STATUS
  account               Account for tmc resources                                       mission-control  v0.1.3   not installed
  agentartifacts        helm for tmc resources                                          mission-control  v0.1.3   not installed
  aks-cluster           Manage and unmanage tmc aks clusters                            mission-control  v0.1.6   not installed
  apply                 Create/Update a resource with a resource file                   mission-control  v0.3.0   installed
  audit                 Run an audit request on an org                                  mission-control  v0.1.3   not installed
  cluster                                                                               mission-control  v0.1.6   installed
  clustergroup          A group of Kubernetes clusters                                  mission-control  v0.1.3   not installed
  continuousdelivery    Continuousdelivery for tmc resources                            mission-control  v0.1.3   not installed
  data-protection       Data protection for tmc resources                               mission-control  v0.1.3   not installed
  ekscluster                                                                            mission-control  v0.1.3   not installed
  events                Events for any meaningful user activity or system state change  mission-control  v0.1.3   not installed
  helm                  helm for tmc resources                                          mission-control  v0.1.3   not installed
  iam                   IAM Policies for tmc resources                                  mission-control  v0.1.3   not installed
  inspection            Inspection for tmc resources                                    mission-control  v0.1.3   not installed
  integration           Get available integrations and their information from registry  mission-control  v0.1.3   not installed
  management-cluster    A TMC registered Management cluster                             mission-control  v0.1.3   not installed
  policy                Policy for tmc resources                                        mission-control  v0.1.3   not installed
  provider-aks-cluster  Manage and unmanage tmc provider aks clusters                   mission-control  v0.1.3   not installed
  provider-eks-cluster                                                                  mission-control  v0.1.3   not installed
  secret                secret for tmc resources                                        mission-control  v0.1.3   not installed
  setting               Setting plugin for tmc resources                                mission-control  v0.2.1   not installed
  tanzupackage          Tanzupackage for tmc resources                                  mission-control  v0.2.2   not installed
  workspace             A group of Kubernetes namespaces                                mission-control  v0.1.5   not installed

[!] As shown above, some recommended plugins have not been installed or are outdated. To install them please run 'tanzu plugin sync'.


$ tz plugin search --name apps --show-details
name: apps
description: Applications on Kubernetes
target: kubernetes
latest: v0.12.1
versions:
    - v0.9.0
    - v0.10.0
    - v0.11.1
    - v0.12.1

# Install an individual plugin with a specific version
$ tz plugin install apps --version v0.11.1
[i] Installing plugin 'apps:v0.11.1' with target 'kubernetes'
[ok] successfully installed 'apps' plugin

# Check plugin describe
$ tz plugin describe cluster
[x] : unable to uniquely identify plugin 'cluster'. Please specify the target (kubernetes[k8s]/mission-control[tmc]/global) of the plugin using the `--target` flag
$ tz plugin describe cluster --target k8s
  NAME     VERSION  STATUS     TARGET      DESCRIPTION                    INSTALLATIONPATH
  cluster  v0.30.1  installed  kubernetes  Kubernetes cluster operations  /Users/kmarc/Library/Application
                                                                          Support/tanzu-cli/cluster/v0.30.1_411f6863357d4f1b1c8482a2499d40fff56c1552de57f7f57310fde721cf0b50_kubernetes
$ tz plugin describe cluster --target tmc
  NAME     VERSION  STATUS     TARGET           DESCRIPTION                       INSTALLATIONPATH
  cluster  v0.1.6   installed  mission-control  A TMC managed Kubernetes cluster  /Users/kmarc/Library/Application
                                                                                  Support/tanzu-cli/cluster/v0.1.6_08ed706484b277282a0bb08cf8fb62b4ac919fc33b97de7fe9739ea1c7501a14_mission-control


$ # Check the root commands
$ tz -h
Usage:
  tanzu [command]

Available command groups:

  Build
    apps                    Applications on Kubernetes

  Run
    cluster                 Kubernetes cluster operations
    feature                 Operate on features and featuregates
    isolated-cluster        Prepopulating images/bundle for internet-restricted environments
    kubernetes-release      Kubernetes release operations
    management-cluster      Kubernetes management cluster operations
    package                 Tanzu package management
    secret                  Tanzu secret management
    telemetry               configure cluster-wide settings for vmware tanzu telemetry

  System
    completion              Output shell completion code
    config                  Configuration for the CLI
    context                 Configure and manage contexts for the Tanzu CLI
    init                    Initialize the CLI
    plugin                  Manage CLI plugins
    version                 Version information

  Target
    kubernetes              Tanzu CLI plugins that target a Kubernetes cluster
    mission-control         Tanzu CLI plugins that target a Tanzu Mission Control endpoint


Flags:
  -h, --help   help for tanzu

Use "tanzu [command] --help" for more information about a command.
$ tz tmc -h
Tanzu CLI plugins that target a Tanzu Mission Control endpoint

Usage:
  tanzu mission-control [command]

Available command groups:

  Manage
    apply                   Apply a resource file
    cluster                 A TMC managed Kubernetes cluster


Flags:
  -h, --help   help for mission-control

Use "tanzu mission-control [command] --help" for more information about a command.
$ tz k8s -h
Tanzu CLI plugins that target a Kubernetes cluster

Usage:
  tanzu kubernetes [command]

Available command groups:

  Build
    apps                    Applications on Kubernetes

  Run
    cluster                 Kubernetes cluster operations
    feature                 Operate on features and featuregates
    kubernetes-release      Kubernetes release operations
    management-cluster      Kubernetes management cluster operations
    package                 Tanzu package management
    secret                  Tanzu secret management
    telemetry               configure cluster-wide settings for vmware tanzu telemetry


Flags:
  -h, --help   help for kubernetes

Use "tanzu kubernetes [command] --help" for more information about a command.

$ # check that the telemetry plugin using the "global" target is being called
$ tz telemetry version
v1.1.0
$ tz telemetry info
{"name":"telemetry","description":"configure cluster-wide settings for vmware tanzu telemetry","target":"global","version":"v1.1.0","buildSHA":"4a19b20","digest":"","group":"Run","docURL":"","completionType":0,"pluginRuntimeVersion":"v1.0.0-dev.0.20230712185745-27ac1d59d87f"}

$ # rm the config and see that the central repo is added automatically
$ rm ~/.config/tanzu/config*
$
$ tz plugin search --name apps
? You must agree to the VMware General Terms in order to download, install, or
[..]
Do you agree to participate in the Customer Experience Improvement Program?
 No

==
  NAME  DESCRIPTION                 TARGET      LATEST
  apps  Applications on Kubernetes  kubernetes  v0.12.1
$ rm ~/.config/tanzu/config*
$ tz config get
? You must agree to the VMware General Terms in order to download, install, or
[..]
Do you agree to participate in the Customer Experience Improvement Program?
 No

==
clientOptions:
    cli:
        edition: tkg
        bomRepo: projects.registry.vmware.com/tkg
        compatibilityFilePath: tkg-compatibility
    features:
        global:
            context-target-v2: "true"
cli:
    ceipOptIn: "false"
    eulaStatus: accepted
    discoverySources:
        - oci:
            name: default
            image: projects.registry.vmware.com/tanzu_cli/plugins/plugin-inventory:latest
    cliId: ad640bec-7603-4c36-b36e-0c99e2c5b2b0
    telemetry:
        source: /Users/kmarc/.config/tanzu-cli-telemetry/cli_metrics.db


$ # a little more checking of plugin DB
$ tz plugin group search
  GROUP                       DESCRIPTION                          LATEST
  vmware-tanzucli/essentials  Essential plugins for the Tanzu CLI  v1.0.0
  vmware-tap/default          Plugins for TAP                      v1.6.3
  vmware-tkg/default          Plugins for TKG                      v2.3.0

$ tz plugin group get vmware-tkg/default -o json
[
  {
    "group": "vmware-tkg/default:v2.3.0",
    "pluginname": "isolated-cluster",
    "plugintarget": "global",
    "pluginversion": "v0.30.1"
  },
  {
    "group": "vmware-tkg/default:v2.3.0",
    "pluginname": "management-cluster",
    "plugintarget": "kubernetes",
    "pluginversion": "v0.30.1"
  },
  {
    "group": "vmware-tkg/default:v2.3.0",
    "pluginname": "package",
    "plugintarget": "kubernetes",
    "pluginversion": "v0.30.1"
  },
  {
    "group": "vmware-tkg/default:v2.3.0",
    "pluginname": "pinniped-auth",
    "plugintarget": "global",
    "pluginversion": "v0.30.1"
  },
  {
    "group": "vmware-tkg/default:v2.3.0",
    "pluginname": "secret",
    "plugintarget": "kubernetes",
    "pluginversion": "v0.30.1"
  },
  {
    "group": "vmware-tkg/default:v2.3.0",
    "pluginname": "telemetry",
    "plugintarget": "kubernetes",
    "pluginversion": "v0.30.1"
  }
]%

Release note

Cleanup unused code around the previous use of feature flags for the context feature and the central repo feature.

Additional information

Special notes for your reviewer

I have looked at the test coverage for the unit tests that this PR modifies and the coverage is about the same or more.

@marckhouzam marckhouzam requested a review from a team as a code owner September 15, 2023 16:10
@marckhouzam marckhouzam changed the title Cleanup the use of feature flags Cleanup the use of feature flags (part 1) Sep 15, 2023
This commit removes the code that was no longer run due to feature flags
not being supported anymore.  The unit tests are also updated to match
this reality.

Furthermore, now that we don't support turning off the Central repo of
plugins feature, the only OCI discovery that is supported is the
"DBBackedOCIDiscovery", so this commit removes the "OCIDiscovery" type
and its supporting code.

Signed-off-by: Marc Khouzam <kmarc@vmware.com>
@marckhouzam marckhouzam changed the title Cleanup the use of feature flags (part 1) Cleanup the use of feature flags (except for the plugin manager) Sep 19, 2023
Copy link
Contributor

@anujc25 anujc25 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 for all the changes. 👍

pkg/command/plugin.go Show resolved Hide resolved
@marckhouzam marckhouzam merged commit 7796f79 into vmware-tanzu:main Sep 19, 2023
4 checks passed
@marckhouzam marckhouzam deleted the feat/cleanupFeatFlags branch September 19, 2023 17:27
@marckhouzam marckhouzam added this to the 1.1.0 milestone Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants