vmware-tanzu / tanzu-cli

The Tanzu Core CLI project provides the core functionality of the Tanzu CLI. The CLI is based on a plugin architecture where CLI command functionality can be delivered through independently developed plugin binaries
Apache License 2.0
33 stars 21 forks source link

Remove warning message regarding the current kubecontext while deleting the tanzu context #770

Closed prkalle closed 3 months ago

prkalle commented 3 months ago

What this PR does / why we need it

This PR removed the warning message regarding the current kubecontext while deleting the tanzu context

Describe testing done for PR

Deleted the current CLI context (which also has corresponding kubecontext which is current). There is no warning message shown when the current kubecontext is deleted.

❯ ./bin/tanzu context list
  NAME                                  ISACTIVE  TYPE             PROJECT            SPACE
  TAP_pre-integration-staging-d03c5c97  false     tanzu            kmihova-15may
  TAP_staging-staging-2761fd6c          false     tanzu            amitjain           amit-space
  Tap-SaaS-Beta3                        false     tanzu
  mytmc-ctx                             false     mission-control  n/a                n/a
  prem-test-context                     false     tanzu
  tap-saas-ga-1                         true      tanzu            longevity-project  amit-dev
  tkg-mgmt-vc                           false     kubernetes       n/a                n/a
  tt-test-selfmg                        false     mission-control  n/a                n/a
  ucp                                   false     tanzu

[i] Use '--wide' to view additional columns.
❯ ./bin/tanzu context use TAP_staging-staging-2761fd6c
[i] Successfully activated context 'TAP_staging-staging-2761fd6c' (Type: tanzu, Project: amitjain (308a292c-9be4-4974-a993-855b1202d2c9), Space: amit-space)
❯ tk config get-contexts
CURRENT   NAME                                                           CLUSTER                                                        AUTHINFO                                              NAMESPACE
          tanzu-cli-TAP_pre-integration-staging-d03c5c97:kmihova-15may   tanzu-cli-TAP_pre-integration-staging-d03c5c97:kmihova-15may   tanzu-cli-TAP_pre-integration-staging-d03c5c97-user
*         tanzu-cli-TAP_staging-staging-2761fd6c:amitjain:amit-space     tanzu-cli-TAP_staging-staging-2761fd6c:amitjain:amit-space     tanzu-cli-TAP_staging-staging-2761fd6c-user
          tanzu-cli-Tap-SaaS-Beta3:tanzu-platform-demo                   tanzu-cli-Tap-SaaS-Beta3:tanzu-platform-demo                   tanzu-cli-Tap-SaaS-Beta3-user
          tanzu-cli-prem-test-context                                    tanzu-cli-prem-test-context                                    tanzu-cli-prem-test-context-user
          tanzu-cli-tap-saas-ga-1:longevity-project:amit-dev             tanzu-cli-tap-saas-ga-1:longevity-project:amit-dev             tanzu-cli-tap-saas-ga-1-user
❯ ./bin/tanzu context delete TAP_staging-staging-2761fd6c
Deleting the context entry from the config will remove it from the list of tracked contexts. You will need to use `tanzu context create` to re-create this context. Are you sure you want to continue? [y/N]: y
[i] Deleting kubeconfig context 'tanzu-cli-TAP_staging-staging-2761fd6c:amitjain:amit-space' from the file '/Users/pkalle/.config/tanzu/kube/config'
[ok] Successfully deleted context "TAP_staging-staging-2761fd6c"
❯ tk config get-contexts
CURRENT   NAME                                                           CLUSTER                                                        AUTHINFO                                              NAMESPACE
          tanzu-cli-TAP_pre-integration-staging-d03c5c97:kmihova-15may   tanzu-cli-TAP_pre-integration-staging-d03c5c97:kmihova-15may   tanzu-cli-TAP_pre-integration-staging-d03c5c97-user
          tanzu-cli-Tap-SaaS-Beta3:tanzu-platform-demo                   tanzu-cli-Tap-SaaS-Beta3:tanzu-platform-demo                   tanzu-cli-Tap-SaaS-Beta3-user
          tanzu-cli-prem-test-context                                    tanzu-cli-prem-test-context                                    tanzu-cli-prem-test-context-user
          tanzu-cli-tap-saas-ga-1:longevity-project:amit-dev             tanzu-cli-tap-saas-ga-1:longevity-project:amit-dev             tanzu-cli-tap-saas-ga-1-user

Release note

Additional information

Special notes for your reviewer