refactor: unify backend k8s objects handler for UI#517
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors backend Kubernetes object handlers for the UI by creating a unified generic handler that eliminates code duplication across different API endpoints. The changes introduce a type-safe generic approach to handling Kubernetes object lists.
Key changes:
- Introduces a generic
K8sObjectsHandlerthat can handle any Kubernetes object list type - Replaces four specific handlers with a single parameterized handler
- Adds a utility function
GetObjectsListfor type-safe Kubernetes object retrieval
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| kof-operator/internal/server/handlers/k8s_objects_handler.go | New generic handler that processes any Kubernetes object list type and returns a unified response format |
| kof-operator/internal/k8s/objects.go | New utility function using reflection to create and populate Kubernetes object lists in a type-safe manner |
| kof-operator/cmd/main.go | Updated API route registrations to use the generic handler with specific type parameters for each endpoint |
08957e8 to
1875cab
Compare
gmlexx
previously approved these changes
Sep 9, 2025
denis-ryzhkov
previously approved these changes
Sep 9, 2025
304552e
1875cab to
304552e
Compare
denis-ryzhkov
approved these changes
Sep 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #76