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

[DO-NOT-MERGE] TESTS: Discover Plugins from all active contexts and Support Plugin Name conflicts across different Targets #4049

Closed
wants to merge 24 commits into from

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Nov 30, 2022

What this PR does / why we need it

Creating a new PR from the branch on this repo. PR is same as #3961 and has been created to verify the pipeline runs when PR is created from branch on this repo.

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

Release note


Additional information

Special notes for your reviewer

- Exclude admin plugins from k8s target
- Remove default ContextType as k8s
- Include sha256 in the plugin filename when storing
- Update catalog
- Refactoring plugin manager functions to remove serverName
- Add target flag to commands and integrate it with implementation

Squash:
Update unit tests
Update go.mod
Fix dependencies
Rename ContextType to Target for Plugins
Feature-flag the changes regarding plugin discovery
Add GetAllCurrentContextMap and list
Remove ContextType from discoverySource
Add unit tests for GetAllCurrentContextsMap
Refactor and fix unit tests
Update helptext for target flag
Fix linter errors
Update go modules
Update test files
This is required because of k8s targeted plugin still relies on
`current` field and we do not want to update that field when context for
tmc targeted context changes.

Scenario:

1. config.yaml looks like below
```
current: kind-test-cluster-2
currentContext:
    tmc: tmc-unstable
    k8s: kind-test-cluster-2
```
2. tanzu tkr get or tanzu k8s tkr get talks to kind-test-cluster-2
   and returns the result.
3. tanzu tmc iam command should use currentContext.tmc and talk to
   tmc-unstable endpoint.
4. If user does, tanzu context use tmc-dev to point to new tmc dev
   endpoint, based on the existing behavior it will update the
   currentContext.tmc as well as current to point to tmc-dev .
```
current: tmc-dev
currentContext:
    tmc: tmc-dev
    k8s: kind-test-cluster-2
```
5. Because, old tkr plugin still uses current to determine the
   cluster to talk to tanzu k8s tkr get will not work anymore as
   it is pointing to tmc endpoint.
@anujc25
Copy link
Contributor Author

anujc25 commented Nov 30, 2022

/test install-vc7

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4049/20221130085524/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 Nov 30, 2022

Codecov Report

Merging #4049 (992f974) into main (69bb600) will decrease coverage by 0.63%.
The diff coverage is 48.71%.

@@            Coverage Diff             @@
##             main    #4049      +/-   ##
==========================================
- Coverage   48.22%   47.58%   -0.64%     
==========================================
  Files         433      457      +24     
  Lines       43122    44740    +1618     
==========================================
+ Hits        20795    21290     +495     
- Misses      20343    21446    +1103     
- Partials     1984     2004      +20     
Impacted Files Coverage Δ
cli/core/pkg/cli/cmd.go 0.00% <ø> (ø)
cli/core/pkg/command/config.go 41.07% <0.00%> (+0.89%) ⬆️
cli/core/pkg/command/context.go 6.51% <0.00%> (-0.46%) ⬇️
cli/core/pkg/command/discovery_source.go 40.90% <0.00%> (-0.38%) ⬇️
cli/core/pkg/command/doc.go 3.07% <0.00%> (ø)
cli/core/pkg/command/init.go 5.55% <0.00%> (+0.67%) ⬆️
cli/core/pkg/command/plugin_manager.go 8.22% <0.00%> (+0.64%) ⬆️
cli/core/pkg/command/root.go 0.00% <0.00%> (ø)
cli/core/pkg/config/discovery.go 74.07% <ø> (-0.93%) ⬇️
cli/runtime/apis/config/v1alpha1/clientconfig.go 32.53% <0.00%> (-5.43%) ⬇️
... and 46 more

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

@alfredthenarwhal
Copy link
Collaborator

@anujc25: /test install-vc7
Commit: 4cabafc

Tests failed! Build no: 3404

@anujc25
Copy link
Contributor Author

anujc25 commented Nov 30, 2022

/test install-vc7

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4049/20221130164059/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.

@anujc25 anujc25 force-pushed the support-plugin-name-conflicts branch from 5221503 to fea415e Compare November 30, 2022 17:10
@alfredthenarwhal
Copy link
Collaborator

@anujc25: /test install-vc7
Commit: 5221503

Build failed! Build no: 3409

@anujc25
Copy link
Contributor Author

anujc25 commented Nov 30, 2022

/test install-vc7

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4049/20221130172128/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.

@alfredthenarwhal
Copy link
Collaborator

@anujc25: /test install-vc7
Commit: fea415e

Build failed! Build no: 3410

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4049/20221130205101/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.

@anujc25 anujc25 closed this Nov 30, 2022
@anujc25 anujc25 deleted the support-plugin-name-conflicts branch December 1, 2022 22:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants