Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] vela cli uses namespace from kubeconfig if env not set #5121

Closed
Kolossi opened this issue Nov 24, 2022 · 2 comments · Fixed by #5182
Closed

[Feature] vela cli uses namespace from kubeconfig if env not set #5121

Kolossi opened this issue Nov 24, 2022 · 2 comments · Fixed by #5182
Assignees
Labels
Milestone

Comments

@Kolossi
Copy link
Contributor

Kolossi commented Nov 24, 2022

If vela env set has not been used, and a vela command requiring a namespace is used without specifying namespace, then use the namespace from the current KUBECONFIG rather than default.

Example commands would include:

  • vela status
  • vela up
  • vela list
  • ... or any other command which accepts -n | --namesapce

Current behaviour:

$ kubectl config view --minify -o jsonpath='{.contexts[?(@.name == "'$(kubectl config view -o=jsonpath='{.current-context}')'")].context.namespace}'
my-namespace

$ kubeconfig get application
NAME                COMPONENT               TYPE           PHASE              HEALTHY   STATUS      AGE
my.app              my.app.component        webservice     workflowSucceeded  true      Ready:1/1   44h

$ vela list my.app
APP     COMPONENT       TYPE    TRAITS  PHASE   HEALTHY STATUS  CREATED-TIME

$ vela status my.app
Error: failed to load application my.app from namespace default: applications.core.oam.dev "my.app" not found

Desired behaviour:

$ kubectl config view --minify -o jsonpath='{.contexts[?(@.name == "'$(kubectl config view -o=jsonpath='{.current-context}')'")].context.namespace}'
my-namespace

$ kubeconfig get application
NAME                COMPONENT               TYPE           PHASE              HEALTHY   STATUS      AGE
my.app              my.app.component        webservice     workflowSucceeded  true      Ready:1/1   44h

$ vela list my.app
APP     COMPONENT         TYPE        TRAITS   PHASE               HEALTHY  STATUS     CREATED-TIME
my.app  my.app.component  webservice  gateway  workflowSucceeded   healthy  Ready:1/1  2022-11-22 16:44:15 +0000 GMT

$ vela status my.app
{status output...}

(vela list and vela status find app in kubeconfig current namespace my-namespace)

Initially discussed with @wonderflow and @FogDong in this slack thread

@wonderflow wonderflow added this to the KubeVela-v1.7 milestone Nov 25, 2022
@PratikforCoding
Copy link

can you provide some resources to go though and get some hints to resolve this?

@Kolossi
Copy link
Contributor Author

Kolossi commented Dec 6, 2022

can you provide some resources to go though and get some hints to resolve this?

@PratikforCoding is that targetted at me? I'm afraid I don't know how to resolve it, I've nothing else I can add aside the repro in my OP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants