cloud-code-intellij icon indicating copy to clipboard operation
cloud-code-intellij copied to clipboard

Kubernetes Explorer does not show right contexts

Open viniciusccarvalho opened this issue 3 years ago • 5 comments

The view has stale data, and forcing a refresh does not change it. I can't get it to show new clusters. There's also an issue with Cloud Run managed where it fails to load any GKE cluster saying there's a connection problem (not the case)

Cloud Code : Version 20.12.2 IntelliJ: 2020.3 Mac Os: 10.15.7

Screen Shot 2020-12-11 at 10 48 50 AM

 kubectl config get-contexts
CURRENT   NAME                                              CLUSTER                                              AUTHINFO                                             NAMESPACE
          demo-cluster                                      gke_vinnyc-demo-project_us-central1-c_demo-cluster   gke_vinnyc-demo-project_us-central1-c_demo-cluster   micronaut
*         gke_vinnyc-demo-project_us-central1-c_cluster-1   gke_vinnyc-demo-project_us-central1-c_cluster-1      gke_vinnyc-demo-project_us-central1-c_cluster-1
          jvm-tests                                         gke_vinnyc-demo-project_us-central1-c_jvm-tests      gke_vinnyc-demo-project_us-central1-c_jvm-tests      default 

viniciusccarvalho avatar Dec 11 '20 15:12 viniciusccarvalho

Hi @viniciusccarvalho thanks for reporting your issue! Our Kubernetes explorer doesn't show context, it shows clusters, and it's a different thing - clusters may have a context, may not have a context (context deleted, but cluster is not deleted), and may have multiple contexts.

As we see from your screenshot, all clusters you have with your contexts are present in the view. You also have some other clusters that do not have contexts (i.e. gke_blue..., ..tracing_cluster, etc). Did you remove context for them but never removed the cluster itself? You can easily see which clusters do not have a context for them (we show context count next to the cluster name).

ivanporty avatar Dec 11 '20 16:12 ivanporty

There's also an issue with Cloud Run managed where it fails to load any GKE cluster saying there's a connection problem (not the case)

Does this view show any Cloud Run services, i.e. managed ones, and fail to load Cloud Run Anthos (based on GKE clusters), or you're not able to see any Cloud Run services at all?

ivanporty avatar Dec 11 '20 16:12 ivanporty

Hi @viniciusccarvalho thanks for reporting your issue! Our Kubernetes explorer doesn't show context, it shows clusters, and it's a different thing - clusters may have a context, may not have a context (context deleted, but cluster is not deleted), and may have multiple contexts.

As we see from your screenshot, all clusters you have with your contexts are present in the view. You also have some other clusters that do not have contexts (i.e. gke_blue..., ..tracing_cluster, etc). Did you remove context for them but never removed the cluster itself? You can easily see which clusters do not have a context for them (we show context count next to the cluster name).

Yes those clusters are long gone, its not intuitive how to remove them. I was expecting that cloud code would simply pull the context from my kubeconfig and use it.

So how do you remove those clusters? I was expecting a right click -> delete to be an option

viniciusccarvalho avatar Dec 11 '20 16:12 viniciusccarvalho

The reason we do not include delete options for clusters and contexts is that it could easily go wrong and adding them back is not always easy. Delete operations on contexts and clusters are not expected to be a frequent action (i.e. it's not day to day operation). However, feel free to file an enhancement if you think delete functionality is something you're using often (for clusters, contexts, and actual resources such as pods/deployments etc.)

To remove a cluster, simply call kubectl config delete-cluster NAME

ivanporty avatar Dec 11 '20 17:12 ivanporty

@viniciusccarvalho with regards to the k8s issue: I believe, as @ivanporty mentioned, that Cloud Code is doing the right thing here. We display the information from your kubeconfig file; if this is not the case for you please let us know. Regarding adding a delete option, that is a feature request we can consider separately (though all of the caveats and dangers of this need to be considered).

For the Cloud Run service browser issue: would you mind providing a bit more detail (even in a new issue)? A screenshot of what you see in the IDE would help. Also - do you have Cloud Run services (that you can view in the Cloud web console)?

etanshaul avatar Dec 16 '20 15:12 etanshaul

Delete has been implemented.

ivanporty avatar Dec 07 '23 00:12 ivanporty