Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

How to get current namespace when creating a custom list view? #3236

Open
fengye87 opened this issue Apr 1, 2022 · 0 comments
Open

How to get current namespace when creating a custom list view? #3236

fengye87 opened this issue Apr 1, 2022 · 0 comments

Comments

@fengye87
Copy link

fengye87 commented Apr 1, 2022

What steps did you take and what happened:
I was trying to write a plugin that supports a custom resource list view. When listing objects, how can I get current user selected namespace?

Screen Shot 2022-04-01 at 5 01 45 PM

router.HandleFunc("*", func(request service.Request) (component.ContentResponse, error) {
	podList, err := request.DashboardClient().List(request.Context(), store.Key{
		Namespace:  "default", // TODO: how to get current namespace?
		APIVersion: "v1",
		Kind:       "Pod",
	})
	if err != nil {
		return *contentResponse, err
	}
	...
})

Environment:

  • Octant version (use octant version): 0.25.1
  • Kubernetes version (use kubectl version): 1.23.5
  • OS (macOS 10.15, Windows 10, Ubuntu 19.10 etc): Fedora 35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant