Skip to content

✨ prototyping dynamic graphql handler for catalogd #2109

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joelanford
Copy link
Member

Veeeeeerrrrrrrrrry rough around the edges PR that gets a graphql handler added to the catalogd server (behind a feature gate). Not really happy at all yet with the library refactoring that adds the Indexer and Index types. But for now it at least gets the job done for this prototype.

The idea here is that when we store an FBC, we build up a graphql schema dynamically based on the content of the FBC. The result being that catalogd is still a "dumb pipe" for FBC data. The GraphQL API is directly derived from the FBC API (or at least the parts of the FBC API that are in use somewhere in the served FBC).

To play with it, I've enabled the GraphQL explorer handler, so you can:

make run-experimental
kubectl port-forward -n olmv1-system service/catalogd-service 8443:443

And then open https://localhost:8443/catalogs/operatorhubio/api/v1/graphql

And here's are some interesting queries to run:

Bundle search metadata

{
  olmBundle {
    package
    name
    properties(type: "olm.csv.metadata") {
      value(jq:".annotations | [to_entries[] | select(.key | test(\"features|valid-subscription|description|capabilities|categories\"))] | from_entries")
    }
  }
}

What OLMv1 operator-controller actually needs for resolution:

{
  olmChannel {
    package
    name
    entries {
      name
      replaces
      skips
      skipRange
    }
  }
  olmBundle {
    package
    name
    image
  }
}

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 17, 2025
Copy link

netlify bot commented Jul 17, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit c4cdc70
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/687c2f44b9566f0008502768
😎 Deploy Preview https://deploy-preview-2109--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

openshift-ci bot commented Jul 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tmshort for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@joelanford joelanford force-pushed the catalogd-graphql branch 2 times, most recently from 7deca0f to f0f601d Compare July 19, 2025 04:17
Copy link

codecov bot commented Jul 20, 2025

Codecov Report

Attention: Patch coverage is 50.81301% with 605 lines in your changes missing coverage. Please review.

Project coverage is 70.05%. Comparing base (0491775) to head (c4cdc70).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...r/internal/handlerutil/http_preconditions_check.go 0.00% 133 Missing ⚠️
...ternal/catalogd/storage/internal/graphql/schema.go 61.68% 105 Missing and 18 partials ⚠️
internal/catalogd/handler/api/v1/metas.go 3.22% 59 Missing and 1 partial ⚠️
...ernal/catalogd/storage/internal/graphql/context.go 0.00% 51 Missing ⚠️
internal/catalogd/storage/internal/graphql/json.go 16.07% 46 Missing and 1 partial ⚠️
internal/catalogd/storage/indices.go 49.36% 33 Missing and 7 partials ⚠️
internal/catalogd/storage/files.go 61.84% 21 Missing and 8 partials ⚠️
internal/catalogd/handler/api/v1/graphql.go 3.70% 25 Missing and 1 partial ⚠️
internal/catalogd/storage/index/index.go 57.89% 21 Missing and 3 partials ⚠️
internal/catalogd/storage/storage.go 82.00% 14 Missing and 4 partials ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2109      +/-   ##
==========================================
- Coverage   73.48%   70.05%   -3.43%     
==========================================
  Files          78       94      +16     
  Lines        7240     8052     +812     
==========================================
+ Hits         5320     5641     +321     
- Misses       1568     2033     +465     
- Partials      352      378      +26     
Flag Coverage Δ
e2e 40.26% <18.61%> (-3.64%) ⬇️
experimental-e2e 56.14% <49.59%> (+6.14%) ⬆️
unit 50.17% <3.82%> (-8.59%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant