-
Notifications
You must be signed in to change notification settings - Fork 16
Dev/jtanguy/browser k8s #138
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
base: main
Are you sure you want to change the base?
Conversation
cbbd469 to
9688aff
Compare
Signed-off-by: Julien Tanguy <julien.tanguy@corp.ovh.com>
Extract rendering logic into reusable view components with dedicated packages for instances and kubernetes resources. Create shared styles, common views (loading, error, empty), and fix label alignment issues in detail views. Signed-off-by: Julien Tanguy <julien.tanguy@corp.ovh.com>
46e5cf4 to
d3e29d2
Compare
3170d9f to
3b58f20
Compare
3b58f20 to
be386c0
Compare
32e439f to
41a8700
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds Kubernetes support to the interactive “browser” TUI, including cluster listing, detail/actions, and node pool management.
Changes:
- Introduces shared view primitives (interface/base/context), common views, and centralized styling helpers.
- Adds Kubernetes-specific views (table/detail/node pools + action flows like upgrade/policy/delete and k9s integration).
- Updates the
browsercommand help text and regenerates CLI docs (adds--filteroption docs for container-registry commands).
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/services/browser/views/view.go | Adds view interface, shared context, and base view helpers for the TUI views. |
| internal/services/browser/views/styles.go | Centralizes lipgloss colors/styles and rendering helpers used across views. |
| internal/services/browser/views/kubernetes/table.go | New Kubernetes clusters table view with filtering and selection behavior. |
| internal/services/browser/views/kubernetes/detail.go | New Kubernetes cluster detail view with action selection and confirmation UX. |
| internal/services/browser/views/kubernetes/nodepools.go | Adds node pools list/detail + scale/delete flows and related messages. |
| internal/services/browser/views/instances/table.go | Adds instances table view with filtering (mirrors Kubernetes table UX). |
| internal/services/browser/views/instances/detail.go | Adds instances detail view with action confirmation UX. |
| internal/services/browser/views/common.go | Adds reusable Loading/Error/Empty views and navigation message types. |
| internal/services/browser/api.go | Wires Kubernetes API calls + wizard handlers into the browser model/controller logic. |
| internal/cmd/browser.go | Marks the browser feature as experimental in command description/help. |
| doc/ovhcloud_cloud_container-registry_ip-restrictions_registry_list.md | Regenerated docs: documents new --filter option. |
| doc/ovhcloud_cloud_container-registry_ip-restrictions_management_list.md | Regenerated docs: documents new --filter option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/services/browser/api.go
Outdated
| // Save kubeconfig to file | ||
| homeDir, err := os.UserHomeDir() | ||
| if err != nil { | ||
| return kubeActionMsg{err: fmt.Errorf("failed to get home directory: %w", err)} | ||
| } | ||
|
|
||
| kubeDir := filepath.Join(homeDir, ".kube") | ||
| if err := os.MkdirAll(kubeDir, 0700); err != nil { | ||
| return kubeActionMsg{err: fmt.Errorf("failed to create .kube directory: %w", err)} | ||
| } | ||
|
|
||
| kubeconfigPath := filepath.Join(kubeDir, "config") | ||
| if err := ioutil.WriteFile(kubeconfigPath, []byte(kubeconfig), 0600); err != nil { | ||
| return kubeActionMsg{err: fmt.Errorf("failed to save kubeconfig: %w", err)} | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe should be a temp dir, what do you think ?
Here, it will override the .kube/config of the user silently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, will do that !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rbeuque74 I added a selector to choose where to store the kubeconfig when running command kubeconfig, and when running K9S the kubeconfig is stored in a temp dir.
Signed-off-by: Arthur Amstutz <arthur.amstutz@corp.ovh.com>
41a8700 to
9287d53
Compare
Description
Add kubernetes part of the browser
Fixes #133 (issue)
Type of change
Please delete options that are not relevant.
Checklist:
make docgo mod tidy