-
Notifications
You must be signed in to change notification settings - Fork 667
CONSOLE-4733: Add catalogd metas endpoint support and refactor client/service boundary #15657
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
Conversation
|
QE Approver Docs Approver: PX Approver: |
|
@TheRealJon: This pull request references CONSOLE-4733 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.21.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@TheRealJon: GitHub didn't allow me to assign the following users: jseseCCS. Note that only openshift members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/hold depends on #15376 |
Refactor the catalogd client to be a thin HTTP wrapper that returns raw responses, moving all data processing logic to the catalog service layer. This improves separation of concerns and enables better caching control. Key changes: - Rename Fetch to FetchAll, returning *http.Response instead of processed data - Add buildCatalogdURL helper for consistent URL construction - Move bundle/package processing from client to service layer - Add processCatalog, processPackage, processBundle methods to service - Update cache key structure with helper functions for better organization - Change If-Modified-Since handling to use strings instead of *time.Time - Update all tests to verify HTTP behavior instead of data processing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add support for the catalogd metas endpoint, enabling filtered queries
of catalog metadata. This builds on the refactored client architecture
to provide a new HTTP passthrough endpoint.
Key changes:
- Add CatalogdMetasEndpoint constant (/api/v1/metas)
- Add FetchMetas method to catalogd client for metas endpoint
- Add GetMetas method to catalog service for retrieving metas
- Add catalogdMetasHandler HTTP handler with /api/olm/catalogd/metas/{catalogName} route
- Preserve HTTP request method and query parameters in metas requests
- Add comprehensive tests for new metas functionality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
12d9c81 to
b85f5a7
Compare
|
curl Also the added & updated tests pass in CI /verified by @yapei |
|
@yapei: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/unhold |
jhadvig
left a comment
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.
Adding couple of small comments. Otherwise looks good 👍
Thank you @TheRealJon 🤘
pkg/olm/catalog_client.go
Outdated
| return nil, nil, nil, err | ||
| query := r.URL.Query() | ||
| queryParams := "" | ||
| if len(queryParams) > 0 { |
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.
queryParams are always 0. We probably want query, so we can just omit the if statement
| if len(queryParams) > 0 { | |
| query := r.URL.Query() | |
| queryParams := query.Encode() | |
pkg/olm/catalog_service.go
Outdated
|
|
||
| func getKey(catalog string) string { | ||
| return keyPrefix + catalog | ||
| func getCatlogLastModifiedKey(catalog string) string { |
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.
| func getCatlogLastModifiedKey(catalog string) string { | |
| func getCatalogLastModifiedKey(catalog string) string { |
| s.cache.Delete(key) | ||
| delete(s.index, key) | ||
| delete(s.catalogLastModified, catalogName) | ||
| itemsKey := getCatalogItemsKey(catalogName) |
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.
Love this implementation ❤️
| o.mux.ServeHTTP(w, r) | ||
| } | ||
|
|
||
| func (o *OLMHandler) catalogdMetasHandler(w http.ResponseWriter, r *http.Request) { |
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.
lets add method validation
if r.Method != http.MethodGet && r.Method != http.MethodPost {
w.Header().Set("Allow", "GET")
serverutils.SendResponse(w, http.StatusMethodNotAllowed,
serverutils.ApiError{Err: "Only GET method are supported"})
return
}
...Extract middleware from pkg/server/middleware.go into pkg/middleware/ package to improve separation of concerns and align with standard Go project organization. This refactoring breaks down the monolithic server package by moving HTTP middleware into a focused, reusable library. Changes: - Move middleware from pkg/server to pkg/middleware package - Update all middleware references in server.go and handler.go - Export middleware functions (AuthMiddleware, WithBearerTokenReview, etc.) - Add HTTP method restriction to catalogd metas endpoint - Fix typo: getCatlogLastModifiedKey → getCatalogLastModifiedKey - Simplify query parameter encoding in catalog client 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
@TheRealJon: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
jhadvig
left a comment
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.
Thanks @TheRealJon 👍
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhadvig, TheRealJon The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/label px-approved |
|
/label docs-approved |
|
confirmed the latest code still works, adding back labels |
|
@yapei: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
This commit refactors the OLM catalog client and service architecture to better
separate concerns and add support for the catalogd metas endpoint:
This separation allows the client to focus on HTTP operations while the service
handles business logic and caching.