Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

CLI: Cherry-pick changes from main to support TMC plugins #3373

Closed
wants to merge 4 commits into from
Closed

CLI: Cherry-pick changes from main to support TMC plugins #3373

wants to merge 4 commits into from

Conversation

giri-varma
Copy link
Contributor

@giri-varma giri-varma commented Sep 15, 2022

What this PR does / why we need it

Changes included in this PR:

  1. Add support for TMC-Plugin discovery Adding support for TMC-Plugin discovery  #2950
  2. Add context command CLI: Add context command #2202
  3. Acquire lock before reading tanzu config file to avoid possible misconfigured file reads Acquire lock before reading tanzu config file to avoid possible misconfigured file reads #3177
  4. Add target separation CLI: Add target separation #3126

Which issue(s) this PR fixes

Fixes #3204, #2200, #3175, #2201

Describe testing done for PR

Manually tested the same way as the original PRs. This change shall be picked up for backwards compatibility testing in TKG.

Release note

* Added discovery source for TMC in Tanzu CLI. Also, fixed fetching artifacts over http to handle large file reads by processing chunks at a time.

* Added a context command as part of the Tanzu CLI to create and manage contexts in the CLI.

* Acquire lock before reading tanzu config file to avoid races with config writes.

* Added support for two targets (context types) in Tanzu CLI: `kubernetes`, `mission-control`. This is currently backwards compatible, i.e., the plugins are still available at the root level. In addition to that, we have all the contextual plugins grouped under their corresponding targets.

Note: This is currently behind a feature flag. To enable the flag please run tanzu config set features.global.context-target true and then run `tanzu init` once after the upgrade.

PR Checklist

Please ensure the following:

  • Use good commit messages
  • Ensure PR contains terms all contributors can understand and links all contributors can access
  • Squash the commits into one or a small number of logical commits

Additional information

Special notes for your reviewer

This is not a ground-up change. Am only cherry-picking the below commits from main

  1. Add support for TMC-Plugin discovery git cherry-pick 1775a2720cdfe2791169468e0526f0cee39f7ed9
  2. Add context command git cherry-pick 7a25ddcc63116e2661aebd7a8f8d2eb10aff3e3f
  3. Acquire lock before reading tanzu config file to avoid possible misconfigured file reads 0c14d3ff167e0ce8f792ea28f1b8bb0774316fad
  4. Add target separation git cherry-pick 48a7073624975f972392c9fdb730d290043dd181

* CLI: Add context types in client config

Context replaces Server in the config and will be used for explicit
context management via the core CLI using a dedicated context command.
To start with we would support 2 types of contexts:
1. Kubernetes (management cluster & workload cluster)
2. Tanzu Mission Control

Also, add conversion between server and context types for backwards
compatibility with older core and older plugins.

* CLI: Add context command

This command is used to create, list, use, and delete Tanzu CLI
contexts for various control planes. Deprecated the `login` and
`config server` commands to encourage users to move to context.

Also, excluded generated deepcopy files from codecoverage test.

* CLI: Hide context command behind a feature flag

The context command is hidden behind the feature flag `features.global.context-target`.
This shall be removed once all plugins and successfully tested its working.

Also, remove the deprecation notice for old Server fields and commands, because
the replacement fields and commands for Context are behind the feature flag.

Signed-off-by: Giri <gelumalai@vmware.com>
anujc25 and others added 3 commits September 15, 2022 15:45
…gured file reads(#3177)

Signed-off-by: Anuj Chaudhari <anujc@vmware.com>
Signed-off-by: prajwal gandige sangamesh <pgandigesang@vmware.com>

Signed-off-by: prajwal gandige sangamesh <pgandigesang@vmware.com>
* CLI: Group contextual plugins by context type

Added kubernets and TMC commands under root which further contain
plugins specific to those contexts. The plugins also show up under
root to maintian backwards compatibility.

* CLI: Add context type to plugin discovery source

Currently, most stand-alone plugins are specific to the k8s context.
Hence, adding the context type to discovery source and grouping the
stand-alone plugins by context type. Only the stand-alone plugins
that are associated with a context type show up under the type.

* CLI: Support TMC as current server if active context is TMC

Previously only TKG management clusters were set as current servers
to be safe. This is needed to be backwards compatible with `tanzu login`
which also supports TMC.

Signed-off-by: Giri <gelumalai@vmware.com>
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/3373/20220915230315/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

❗ No coverage uploaded for pull request base (release-0.25@7131595). Click here to learn what that means.
The diff coverage is n/a.

@@               Coverage Diff               @@
##             release-0.25    #3373   +/-   ##
===============================================
  Coverage                ?   45.61%           
===============================================
  Files                   ?      416           
  Lines                   ?    41596           
  Branches                ?        0           
===============================================
  Hits                    ?    18975           
  Misses                  ?    20895           
  Partials                ?     1726           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@giri-varma
Copy link
Contributor Author

Closed in favor of #3385

@giri-varma giri-varma closed this Sep 16, 2022
@giri-varma giri-varma deleted the release-0.25 branch September 16, 2022 20:58
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants