camel-tooling / vscode-camelk

Visual Studio extensions to support Camel K
Apache License 2.0
11 stars 13 forks source link

Update namespace in tooltip for default namespace #191

Open bfitzpat opened 4 years ago

bfitzpat commented 4 years ago

From Aurelien on https://github.com/camel-tooling/vscode-camelk/pull/186

providing the namespace in tooltip and UI of the "current system namespace used" would be useful too (good candidate for next iteration issue/PR)

Right now we only show the namespace if it's set in the user's settings, but it would be nice to get the system default from kubernetes or Camel K and display that as well.

bfitzpat commented 4 years ago

looking at https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ it seems we can get the namespace: kubectl get namespace

And we can set it permanently for all subsequent kubectl calls.

kubectl config set-context --current --namespace=<insert-namespace-name-here>
# Validate it
kubectl config view --minify | grep namespace:

Is that what you're after @apupier ?

apupier commented 4 years ago

On long term, I would like that we use the same logic than what VS Code Kubernetes is doing. I know they can also specify custom kubeconfig in preferences.

this issue was only for the tooltip so that we know the namespace from which the VS Code Camel K view is doing the calls and retrieving the "integrations".

What is used to retrieve the integrations? kubectl? kamel? if kamel, needs to follow this issue as it is not in phase with what kubectl is doing for now: https://github.com/apache/camel-k/issues/1048 so it can create a desynrrhonization if namespace and integrations are retrieved using a different method.

bfitzpat commented 4 years ago

We are using the kubernetes API (k8s.extension.kubectl.v1) to retrieve the list of integrations (see https://github.com/camel-tooling/vscode-camelk/blob/136b26a89ff88cb9b3ed22e8e240a5d759a997e7/src/kubectlutils.ts#L121)