Skip to content

Conversation

@prkalle
Copy link
Contributor

@prkalle prkalle commented May 2, 2024

What this PR does / why we need it

This PR disables syncing of "tanzu" type contexts between legacy and latest CLI config files.
Summary:
Currently when tanzu context type is created , a corresponding server entry would be created. This would result in loss of some fileds(as per the legacy server structure type). Also, this syncing is bi-directional(context <> server). If the latest CLI configuration files is deleted or messed up, the syncing of server types to context type with incomplete data would cause issues for tanzu operations. So disabling the "tanzu" context type syncing between servers) and contexts would solve this issue.

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

  • Unit tests and CI

-Deleted the legacy config file and had the below latest config file (config-ng.yaml) . Now if I execute any CLI command CLI regenerated servers in the legacy config file except the tanzy type server(populated from tanzu context)

contexts:
    - name: tt-test-selfmg
      target: mission-control
      contextType: mission-control
      globalOpts:
        endpoint: tmc-sm-main.local-dev.7infra.com:443
        auth:
            issuer: https://pinniped-supervisor.tmc-sm-main.local-dev.7infra.com/provider/pinniped
            accessToken: <REDACTED>
            IDToken: <REDACTED>
            refresh_token: <REDACTED>
            expiration: 2023-02-13T16:06:27.596807-08:00
            type: id-token
      discoverySources: []
 
    - name: tkg-mgmt-vc
      target: kubernetes
      contextType: kubernetes
      clusterOpts:
        path: /Users/pkalle/temp/tkgCluster_admin.kfg
        context: tkg-mgmt-vc-admin@tkg-mgmt-vc
        isManagementCluster: true
      discoverySources: []
    - name: Tap-SaaS-Beta3
      target: tanzu
      contextType: tanzu
      globalOpts:
        endpoint: https://api.tanzu.cloud.vmware.com
        auth:
            issuer: https://console.cloud.vmware.com/csp/gateway/am/api
            userName: vuichiap
            permissions:
                - external/5ee4ea09-ce47-4e3e-9658-d131511674d4/tap:viewer
                - external/5ee4ea09-ce47-4e3e-9658-d131511674d4/tap:admin
                - csp:org_member
                - external/5ee4ea09-ce47-4e3e-9658-d131511674d4/tap:member
                - external/c939cbfa-190a-4c2b-b09e-7fb6e9716583/ensemble:admin
            accessToken: <REDACTED>
            IDToken: <REDACTED>
            refresh_token: <REDACTED>
            expiration: 2024-05-02T11:50:28.802179-07:00
            type: api-token
      discoverySources: []
cli:
    discoverySources:
        - oci:
            name: default
            image: projects.packages.broadcom.com/tanzu_cli/plugins/plugin-inventory:latest
    cliId: <REDACTED>
    telemetry:
        source: /Users/pkalle/.config/tanzu-cli-telemetry/cli_metrics.db
    eulaStatus: accepted
    eulaAcceptedVersions: v1.1.0
    ceipOptIn: "true"

Now ran the tanzu version with tanzu binary compiled using this PR plugin-runtime changes

❯ rm ~/.config/tanzu/config.yaml
❯ ls ~/.config/tanzu/config.yaml
ls: /Users/pkalle/.config/tanzu/config.yaml: No such file or directory
❯ ./bin/tanzu version
version: v1.3.0-dev
buildDate: 2024-05-02
sha: dd2a15f0-dirty
arch: amd64
❯ ls ~/.config/tanzu/config.yaml
/Users/pkalle/.config/tanzu/config.yaml

The below is the legacy file regenerated/populated and it doesn't contain the tanzu type servers

servers:
    - name: tt-test-selfmg
      type: global
      globalOpts:
        endpoint: tmc-sm-main.local-dev.7infra.com:443
        auth:
            issuer: https://pinniped-supervisor.tmc-sm-main.local-dev.7infra.com/provider/pinniped
            accessToken: <REDACTED>
            IDToken: <REDACTED>
            refresh_token: <REDACTED>
            expiration: 2023-02-13T16:06:27.596807-08:00
            type: id-token
    - name: tkg-mgmt-vc
      type: managementcluster
      managementClusterOpts:
        path: /Users/pkalle/temp/tkgCluster_admin.kfg
        context: tkg-mgmt-vc-admin@tkg-mgmt-vc
  • Performed the similar test by deleting the latest CLI config file( config-ng.yaml) and verified the tanzu type servers existing in the legacy config file are not populated as tanzu type contexts.

Release note

Disable syncing of "tanzu" contexts between legacy and latest CLI configuration files

Additional information

Special notes for your reviewer

@prkalle prkalle requested a review from a team as a code owner May 2, 2024 01:13
Copy link
Contributor

@mpanchajanya mpanchajanya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

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.

LGTM

Copy link
Contributor

@vuil vuil 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!

@prkalle prkalle merged commit 2ef928f into vmware-tanzu:main May 3, 2024
@marckhouzam marckhouzam added this to the v1.3.0 milestone May 13, 2024
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.

5 participants