-
Notifications
You must be signed in to change notification settings - Fork 192
Create separate go modules for apis/cli
and apis/config
#3141
Create separate go modules for apis/cli
and apis/config
#3141
Conversation
Cluster Generation A/B Results: |
This looks great @anujc25. Comparing the |
be97f28
to
dd97d76
Compare
Thanks. Great catch. Updated the PR to update Makefiles. |
Cluster Generation A/B Results: |
Codecov Report
@@ Coverage Diff @@
## main #3141 +/- ##
==========================================
+ Coverage 44.46% 44.93% +0.46%
==========================================
Files 417 412 -5
Lines 42399 41722 -677
==========================================
- Hits 18851 18746 -105
+ Misses 21818 21252 -566
+ Partials 1730 1724 -6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
dd97d76
to
08738f8
Compare
08738f8
to
851c4a1
Compare
Cluster Generation A/B Results: |
Cluster Generation A/B Results: |
851c4a1
to
5dcec40
Compare
Cluster Generation A/B Results: |
@@ -190,12 +190,6 @@ func setEdition(cfg *configv1alpha1.ClientConfig, edition string) error { | |||
switch editionOption { | |||
case configv1alpha1.EditionCommunity, configv1alpha1.EditionStandard: | |||
cfg.SetEditionSelector(editionOption) | |||
// when community edition is set, configure the compatibility file to use | |||
// community edition's. | |||
err := cfg.SetCompatibilityFile(editionOption) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed from core-cli code and moved to individual plugin command invocations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now I'm completely out of my element, but please be patient with me.
I was curious about the change in logic about SetCompatibilityFile
. Looking at the change, I'm guessing that this compatibility file is only used when creating a cluster? That is why you only need to trigger it for the managed-cluster
and cluster
plugins?
But somehow (probably me doing something wrong), the main configuration file does not get updated properly anymore. This is a simplification of what I did:
# Check that the main config file is set to tkg (BOM and edition)
$ egrep 'bom|edition' ~/.config/tanzu/config.yaml
bomRepo: projects-stg.registry.vmware.com/tkg
edition: tkg
# Set the edition to TCE
$ tanzu config set cli.edition tce
# =====> Notice the BOM is no longer set properly
$ egrep 'bom|edition' ~/.config/tanzu/config.yaml
bomRepo: projects-stg.registry.vmware.com/tkg
edition: tce
# Remove the BOM line completely
$ grep -v bom ~/.config/tanzu/config.yaml > tt && \mv tt ~/.config/tanzu/config.yaml && grep bom ~/.config/tanzu/config.yaml
# Regenerate the config file by running any command
$ tanzu
Tanzu CLI
Usage:
tanzu [command]
[...]
# =====> Notice the BOM is added but does not match the edition
$ egrep 'bom|edition' ~/.config/tanzu/config.yaml
bomRepo: projects-stg.registry.vmware.com/tkg
edition: tce
I don't know if this is actually a problem but it does not happen on the main branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that. I have fixed the problem and added unit test around SetCompatibilityFileBasedOnEdition
function as well.
Please note that tanzu config set cli.edition tce
command will now just update the edition
field in config and BomRepo
and Compatibility
information is updated when user runs cluster
or management-cluster
plugin command. Ideally, BomRepo
and Compatibility
information should not be part of ClientConfig
at the first place and I have filled #3149 for that.
5dcec40
to
224687b
Compare
Cluster Generation A/B Results: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I'm all over the place, this is still pretty new to me...
@@ -190,12 +190,6 @@ func setEdition(cfg *configv1alpha1.ClientConfig, edition string) error { | |||
switch editionOption { | |||
case configv1alpha1.EditionCommunity, configv1alpha1.EditionStandard: | |||
cfg.SetEditionSelector(editionOption) | |||
// when community edition is set, configure the compatibility file to use | |||
// community edition's. | |||
err := cfg.SetCompatibilityFile(editionOption) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now I'm completely out of my element, but please be patient with me.
I was curious about the change in logic about SetCompatibilityFile
. Looking at the change, I'm guessing that this compatibility file is only used when creating a cluster? That is why you only need to trigger it for the managed-cluster
and cluster
plugins?
But somehow (probably me doing something wrong), the main configuration file does not get updated properly anymore. This is a simplification of what I did:
# Check that the main config file is set to tkg (BOM and edition)
$ egrep 'bom|edition' ~/.config/tanzu/config.yaml
bomRepo: projects-stg.registry.vmware.com/tkg
edition: tkg
# Set the edition to TCE
$ tanzu config set cli.edition tce
# =====> Notice the BOM is no longer set properly
$ egrep 'bom|edition' ~/.config/tanzu/config.yaml
bomRepo: projects-stg.registry.vmware.com/tkg
edition: tce
# Remove the BOM line completely
$ grep -v bom ~/.config/tanzu/config.yaml > tt && \mv tt ~/.config/tanzu/config.yaml && grep bom ~/.config/tanzu/config.yaml
# Regenerate the config file by running any command
$ tanzu
Tanzu CLI
Usage:
tanzu [command]
[...]
# =====> Notice the BOM is added but does not match the edition
$ egrep 'bom|edition' ~/.config/tanzu/config.yaml
bomRepo: projects-stg.registry.vmware.com/tkg
edition: tce
I don't know if this is actually a problem but it does not happen on the main branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes looks good
224687b
to
bcead3e
Compare
Cluster Generation A/B Results: |
bcead3e
to
a1ac38c
Compare
Cluster Generation A/B Results: |
a1ac38c
to
9299bd2
Compare
Cluster Generation A/B Results: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience and efforts @anujc25. I think this will pave the way to easier future refactorings for everyone else.
The new tests have to be fixed (they don't compile), but the rest looks great 👍
9299bd2
to
3767818
Compare
Cluster Generation A/B Results: |
Signed-off-by: Anuj Chaudhari <anujc@vmware.com>
Signed-off-by: Anuj Chaudhari <anujc@vmware.com>
3767818
to
ba90d37
Compare
Cluster Generation A/B Results: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
What this PR does / why we need it
apis/cli
apis/config
Which issue(s) this PR fixes
Fixes #3139 and #3140
Describe testing done for PR
Release note
Additional information
Special notes for your reviewer