Skip to content
This repository was archived by the owner on May 18, 2026. It is now read-only.

Error message for missing Kubeconfig and Non-existent context#62

Merged
rashedkvm merged 1 commit into
vmware-tanzu:mainfrom
rashedkvm:kubeconfig-error
Apr 6, 2022
Merged

Error message for missing Kubeconfig and Non-existent context#62
rashedkvm merged 1 commit into
vmware-tanzu:mainfrom
rashedkvm:kubeconfig-error

Conversation

@rashedkvm
Copy link
Copy Markdown
Member

@rashedkvm rashedkvm commented Apr 6, 2022

Signed-off-by: Rashed Kamal krashed@vmware.com

Pull request

What this PR does / why we need it

This PR fixes the UX error message when kubeconfig is missing or the current context is no longer valid.

Which issue(s) this PR fixes

Fixes #53

Describe testing done for PR

  • Unit test
  • Local test

Missing Kubeconfig

➜  ~  tanzu apps workload list -n workspace
Error: Unable to connect: no configuration has been found. If a kubeconfig is not set, it can be provided with the --kubeconfig flag or KUBECONFIG environment variable.
Error: exit status 2

✖  exit status 2

Missing Kubeconfig Verbose

➜  ~  tanzu apps workload list -n workspace -v 2
Error: Unable to connect: no configuration has been found. If a kubeconfig is not set, it can be provided with the --kubeconfig flag or KUBECONFIG environment variable.
API Error name:tanzu apps  error:invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
Error: exit status 2

✖  exit status 2

Invalid Context in Kubeconfig

➜  ~  tanzu apps workload list -n workspace
Error: Unable to connect: connection refused. Confirm kubeconfig details and try again.
Error: exit status 2

✖  exit status 2

Invalid Context in Kubeconfig Verbose

➜  ~  tanzu apps workload list -n workspace -v 2
API Request name:tanzu apps  host:https://xx.xx.xx.xxx  action:List
Error: Unable to connect: connection refused. Confirm kubeconfig details and try again.
API Error name:tanzu apps  error:Get "https://xx.xx.xx.xxx/api?timeout=32s": dial tcp xx.xx.xx.xxx:443: i/o timeout
Error: exit status 2

✖  exit status 2

Additional information or special notes for your reviewer

Signed-off-by: Rashed Kamal <krashed@vmware.com>
@rashedkvm rashedkvm requested review from shashwathi and warango4 April 6, 2022 15:52
@rashedkvm rashedkvm changed the title Error message for Empty Kubeconfig and Non-exist context Error message for Empty Kubeconfig and Non-existent context Apr 6, 2022
@rashedkvm rashedkvm changed the title Error message for Empty Kubeconfig and Non-existent context Error message for missing Kubeconfig and Non-existent context Apr 6, 2022
@rashedkvm rashedkvm marked this pull request as ready for review April 6, 2022 18:11
@rashedkvm rashedkvm merged commit 2b8fc2c into vmware-tanzu:main Apr 6, 2022
@rashedkvm rashedkvm deleted the kubeconfig-error branch April 6, 2022 19:47
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.

Running tanzu apps workload commands when KUBECONFIG is not set or pointing to a cluster that is not accessible/deleted returns a panic error stacktrace

4 participants