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

Panic when running odo list namespaces without an active Kubernetes context #6316

Closed
rm3l opened this issue Nov 17, 2022 · 1 comment · Fixed by #6367
Closed

Panic when running odo list namespaces without an active Kubernetes context #6316

rm3l opened this issue Nov 17, 2022 · 1 comment · Fixed by #6367
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@rm3l
Copy link
Member

rm3l commented Nov 17, 2022

/kind bug

What versions of software are you using?

Operating System:
Fedora 37

Output of odo version:

odo v3.2.0 (ce42ce435)

ce42ce4

How did you run odo exactly?

Just ran odo list namespaces with no active Kubernetes context:

Actual behavior

$ odo list namespaces
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x278ce00]

goroutine 1 [running]:
github.com/redhat-developer/odo/pkg/kclient.(*Client).GetCurrentNamespace(0x333d638?)
        /home/asoro/work/projects/odo/pkg/kclient/namespace.go:164
github.com/redhat-developer/odo/pkg/odo/genericclioptions.GenericRun({0x333e0f0, 0xc000a9cc60}, 0xc000884500, {0x46022b0, 0x0, 0x0})
        /home/asoro/work/projects/odo/pkg/odo/genericclioptions/runnable.go:184 +0xf82
github.com/redhat-developer/odo/pkg/odo/cli/list/namespace.NewCmdNamespaceList.func1(0xc000884500?, {0x46022b0?, 0x0?, 0x0?})
        /home/asoro/work/projects/odo/pkg/odo/cli/list/namespace/namespace.go:79 +0x38
github.com/spf13/cobra.(*Command).execute(0xc000884500, {0x46022b0, 0x0, 0x0})
        /home/asoro/work/projects/odo/vendor/github.com/spf13/cobra/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xc00070e000)
        /home/asoro/work/projects/odo/vendor/github.com/spf13/cobra/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /home/asoro/work/projects/odo/vendor/github.com/spf13/cobra/command.go:902
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /home/asoro/work/projects/odo/vendor/github.com/spf13/cobra/command.go:895
main.main()
        /home/asoro/work/projects/odo/cmd/odo/odo.go:70 +0x425

Expected behavior

odo list namespaces should not panic.

All other commands (like odo list bindings or odo describe component) just display a nicer error message, e.g.:

$ odo list services     
 ✗  
Please ensure you have an active kubernetes context to your cluster. 
Consult your Kubernetes distribution's documentation for more details.
Error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable

Any logs, error output, etc?

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 17, 2022
@rm3l rm3l added this to odo Project Nov 17, 2022
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Nov 17, 2022
@valaparthvi
Copy link
Contributor

Changing the subdep for PROJECT to KUBERNETES instead of KUBERNETES_NULLABLE should ensure that odo does not panic.

@rm3l rm3l removed the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Dec 1, 2022
@rm3l rm3l moved this to In Review 👀 in odo Project Dec 1, 2022
Repository owner moved this from In Review 👀 to Done ✅ in odo Project Dec 5, 2022
@rm3l rm3l added this to the v3.4.0 🚀 milestone Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants