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

Update tanzu context update tanzu-active-resource to support --clustergroup flag #621

Merged
merged 7 commits into from
Dec 27, 2023

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Dec 20, 2023

What this PR does / why we need it

  • Update tanzu context update tanzu-active-resource to support --clustergroup flag
  • As part of this change, the context object within the config-ng.yaml file also saves tanzuClusterGroupName under the additionalMetadata section.
      additionalMetadata:
        tanzuClusterGroupName: clustergroupA
        tanzuOrgID: b1d48027-bb69-4a56-a5b8-e941ef29fa4b
        tanzuProjectName: projectA
        tanzuSpaceName: ""

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

## Set project as active
$ tz context update tanzu-active-resource one-tanzu-demo-1 --project "projectA"
$ tz context list
  NAME              ISACTIVE  TYPE        ENDPOINT                                                                         KUBECONFIGPATH             KUBECONTEXT                 PROJECT   SPACE  CLUSTERGROUP  
  one-tanzu-demo-1  false     tanzu       https://api.tanzu-dev.cloud.vmware.com/org/b1d48027-bb69-4a56-a5b8-e941ef29fa4b  /Users/anujc/.kube/config  tanzu-cli-one-tanzu-demo-1  projectA                       
  tkg-mc-1          true      kubernetes                                                                                   /Users/anujc/.kube/config  kind-mc-1                   n/a       n/a    n/a           
## Set space within a project as active
$ tz context update tanzu-active-resource one-tanzu-demo-1 --project "projectA" --space "spaceA"
$ tz context list
  NAME              ISACTIVE  TYPE        ENDPOINT                                                                         KUBECONFIGPATH             KUBECONTEXT                 PROJECT   SPACE   CLUSTERGROUP  
  one-tanzu-demo-1  false     tanzu       https://api.tanzu-dev.cloud.vmware.com/org/b1d48027-bb69-4a56-a5b8-e941ef29fa4b  /Users/anujc/.kube/config  tanzu-cli-one-tanzu-demo-1  projectA  spaceA                
  tkg-mc-1          true      kubernetes                                                                                   /Users/anujc/.kube/config  kind-mc-1                   n/a       n/a     n/a           
## Set clustergroup within a project as active
$ tz context update tanzu-active-resource one-tanzu-demo-1 --project "projectA" --clustergroup "clustergroupA"
$ tz context list
  NAME              ISACTIVE  TYPE        ENDPOINT                                                                         KUBECONFIGPATH             KUBECONTEXT                 PROJECT   SPACE  CLUSTERGROUP   
  one-tanzu-demo-1  false     tanzu       https://api.tanzu-dev.cloud.vmware.com/org/b1d48027-bb69-4a56-a5b8-e941ef29fa4b  /Users/anujc/.kube/config  tanzu-cli-one-tanzu-demo-1  projectA         clustergroupA  
  tkg-mc-1          true      kubernetes                                                                                   /Users/anujc/.kube/config  kind-mc-1                   n/a       n/a    n/a            
  • Incorrect input tests:
## Try to set space and clustergroup both within a project as active
$ tz context update tanzu-active-resource one-tanzu-demo-1 --project "projectA" --space "spaceA"  --clustergroup "clustergroupA"
[x] : either space or clustergroup can be set as active resource. Please provide either --space or --clustergroup option

## Try to set clustergroup without a project
$ tz context update tanzu-active-resource one-tanzu-demo-1 --clustergroup "clustergroupA"
[x] : clustergroup cannot be set without project name. Please provide project name also using --project option

## Try to set space without a project
$ tz context update tanzu-active-resource one-tanzu-demo-1 --space "spaceA"
[x] : space cannot be set without project name. Please provide project name also using --project option

Release note

Support configuring ClusterGroup with the `tanzu context update  tanzu-active-resource` command using `--clustergroup` flag

Additional information

Special notes for your reviewer

@anujc25 anujc25 added kind/feature Categorizes issue or PR as related to a new feature docs-impact issues with documentation impact labels Dec 21, 2023
@anujc25 anujc25 added this to the v1.2.0 milestone Dec 21, 2023
go.mod Outdated Show resolved Hide resolved
@anujc25 anujc25 marked this pull request as ready for review December 21, 2023 16:39
@anujc25 anujc25 requested a review from a team as a code owner December 21, 2023 16:39
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 assume any improvement to context list will be done in a separate PR?

LGTM

@anujc25
Copy link
Contributor Author

anujc25 commented Dec 26, 2023

I assume any improvement to context list will be done in a separate PR?

LGTM

Correct. UX changes around the tanzu context list will be part of a separate PR.

@prkalle prkalle requested review from prkalle and removed request for prkalle December 26, 2023 19:04
@prkalle prkalle self-requested a review December 26, 2023 22:19
Copy link
Contributor

@prkalle prkalle 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 the changes!

@anujc25 anujc25 merged commit 2535b39 into vmware-tanzu:main Dec 27, 2023
7 checks passed
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 kind/feature Categorizes issue or PR as related to a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants