Closed hcavarsan closed 1 week ago
The changes introduced in this pull request significantly enhance the functionality of the kftray-portforward
project. New asynchronous functions have been added to facilitate the interaction with Kubernetes resources, including the ability to list Kubernetes contexts, retrieve all namespaces, and get services with specific annotations. The core module has been expanded to include functionality for retrieving service configurations based on selected contexts, with added helper functions for parsing and creating configurations.
In the user interface, a new modal component, AutoImportModal
, has been integrated into the application, allowing users to import Kubernetes service configurations based on selected contexts. This modal is accessible from both the footer and the main component of the application, enhancing user interaction. The application state management has been updated to accommodate context selection, and the UI has been modified to reflect these changes, including the addition of a context selection popup.
Overall, the modifications introduce new features for managing Kubernetes resources, improve user experience through enhanced UI components, and streamline the application's functionality related to service configurations and context management.
Files | Change Summary |
---|---|
crates/kftray-portforward/src/client.rs |
Added functions for listing Kubernetes contexts, namespaces, and services with specific annotations. |
crates/kftray-portforward/src/core.rs |
Introduced a function to retrieve service configurations based on context and added helper functions for parsing configurations. |
crates/kftray-tauri/src/commands/kubecontext.rs |
Added a command for retrieving services with annotations, callable from the Tauri frontend. |
crates/kftray-tauri/src/main.rs |
Integrated the new command into the application's command execution process. |
crates/kftui/src/.gitignore |
Removed port forwarding functions, indicating a potential shift in functionality. |
crates/kftui/src/tui/input/mod.rs |
Added state management for context selection and modified input handling to accommodate new functionality. |
crates/kftui/src/tui/input/navigation.rs |
Introduced functions for handling context selection and auto-adding configurations. |
crates/kftui/src/tui/ui/draw.rs |
Updated UI rendering logic to include context selection and modified menu items. |
crates/kftui/src/tui/ui/popup.rs |
Added a function for rendering the context selection popup in the UI. |
frontend/src/components/AutoImportModal/index.tsx |
Introduced a new modal component for importing Kubernetes service configurations with state management and API integration. |
frontend/src/components/Footer/index.tsx |
Integrated the AutoImportModal into the footer with state management for modal visibility. |
frontend/src/components/Main/index.tsx |
Added the AutoImportModal to the main component with state management for visibility. |
frontend/src/types/index.ts |
Introduced a new interface for the AutoImportModal props, enhancing type safety. |
sequenceDiagram
participant User
participant Frontend
participant Backend
participant Kubernetes
User->>Frontend: Open AutoImportModal
Frontend->>Backend: Fetch Kubernetes contexts
Backend->>Kubernetes: List contexts
Kubernetes-->>Backend: Return contexts
Backend-->>Frontend: Send contexts
Frontend->>User: Display contexts in modal
User->>Frontend: Select context and initiate import
Frontend->>Backend: Retrieve service configurations
Backend->>Kubernetes: Get services with annotations
Kubernetes-->>Backend: Return service configurations
Backend-->>Frontend: Send service configurations
Frontend->>User: Display import status
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This PR adds an auto-import feature to KFTray and KFTUI. import Kubernetes service configurations by selecting a context in the new "Auto Import". Services with the annotation
kftray.app/enabled: true
will be imported, and additional configurations can be specified using thekftray.app/configs
annotation in the formatalias-localPort-targetPort
. This feature automates the configuration import process.