!!! warning "Alpha Feature"
The GraphQL endpoint is an alpha feature controlled by the GraphQLCatalogQueries feature gate.
The API and behavior may change in future releases.
After you add a catalog of extensions to your cluster, you can query the catalog using GraphQL for flexible, structured queries with precise field selection.
- You have added a ClusterCatalog of extensions, such as OperatorHub.io, to your cluster.
- The
GraphQLCatalogQueriesfeature gate is enabled in catalogd.
!!! note
By default, Catalogd is installed with TLS enabled for the catalog webserver.
The following examples will show this default behavior, but for simplicity's sake will ignore TLS verification in the curl commands using the -k flag.
You also need to port forward the catalog server service:
kubectl -n olmv1-system port-forward svc/catalogd-service 8443:443
The GraphQL endpoint is available at:
https://localhost:8443/catalogs/<catalog-name>/api/v1/graphql
All queries must be sent as HTTP POST requests with a JSON body containing a query field.
IMPORTANT: GraphQL field names are automatically generated from catalog schema names.
Schema names are converted to GraphQL field names using this process:
- Remove dots and special characters:
olm.bundle→olmbundle - Convert to lowercase:
OLM.Bundle→olmbundle - Append 's' for pluralization:
olmbundle→olmbundles
Examples:
| Schema Name | GraphQL Field Name |
|---|---|
olm.bundle |
olmbundles |
olm.package |
olmpackages |
olm.channel |
olmchannels |
helm.chart |
helmcharts |
To find the exact field names available for your catalog, use GraphQL introspection:
curl -k -X POST 'https://localhost:8443/catalogs/operatorhubio/api/v1/graphql' \
-H "Content-Type: application/json" \
-d '{
"query": "{ __schema { queryType { fields { name description } } } }"
}' | jq
This returns all available query fields for the catalog, including the automatically generated schema-based fields.
!!! warning "Pluralization Limitations"
The current implementation appends 's' to schema names for pluralization. This may not produce grammatically correct English plurals in all cases (e.g., index → indexs instead of indices). When creating custom schemas, use singular nouns that pluralize well with a simple 's' suffix.
Get an overview of schemas and object counts in the catalog:
curl -k -X POST 'https://localhost:8443/catalogs/operatorhubio/api/v1/graphql' \
-H "Content-Type: application/json" \
-d '{
"query": "{ summary { totalSchemas schemas { name totalObjects totalFields } } }"
}' | jq
List bundles with specific fields:
curl -k -X POST 'https://localhost:8443/catalogs/operatorhubio/api/v1/graphql' \
-H "Content-Type: application/json" \
-d '{
"query": "{ olmbundles(limit: 5, offset: 0) { name package image } }"
}' | jq
List packages with metadata:
curl -k -X POST 'https://localhost:8443/catalogs/operatorhubio/api/v1/graphql' \
-H "Content-Type: application/json" \
-d '{
"query": "{ olmpackages(limit: 10) { name description defaultChannel } }"
}' | jq
List channels:
curl -k -X POST 'https://localhost:8443/catalogs/operatorhubio/api/v1/graphql' \
-H "Content-Type: application/json" \
-d '{
"query": "{ olmchannels { name package entries } }"
}' | jq
All schema-based queries support pagination via limit and offset arguments:
curl -k -X POST 'https://localhost:8443/catalogs/operatorhubio/api/v1/graphql' \
-H "Content-Type: application/json" \
-d '{
"query": "{ olmbundles(limit: 10, offset: 20) { name } }"
}' | jq
Select only the fields you need, including nested objects:
curl -k -X POST 'https://localhost:8443/catalogs/operatorhubio/api/v1/graphql' \
-H "Content-Type: application/json" \
-d '{
"query": "{ olmpackages { name icon { mediatype base64data } } }"
}' | jq
Query bundle properties with their type and value fields:
curl -k -X POST 'https://localhost:8443/catalogs/operatorhubio/api/v1/graphql' \
-H "Content-Type: application/json" \
-d '{
"query": "{ olmbundles(limit: 5) { name properties { type value } } }"
}' | jq
Note: The properties field contains an array of objects, each with a type string and a value field that can contain complex nested data. GraphQL will return the full JSON structure for the value field.
| Feature | GraphQL (/api/v1/graphql) |
Metas (/api/v1/metas) |
|---|---|---|
| Field selection | Precise - request only needed fields | All fields always returned |
| Query complexity | Rich queries with nested objects | Simple parameter-based filtering |
| Response size | Minimal - only requested data | Full objects always returned |
| Schema discovery | Introspection built-in | External documentation needed |
| Pagination | Built-in limit and offset |
Manual implementation required |
| HTTP Method | POST only | GET supported |
| Feature status | Alpha (feature gate required) | Stable |
When to use GraphQL:
- You need specific fields from large objects
- You want to query related data in a single request
- You need structured, typed responses
- You're building a UI or client that benefits from precise data fetching
When to use Metas endpoint:
- You need simple, stable API
- You're doing basic filtering by schema/package/name
- You want to use GET requests for caching
- You need guaranteed API stability
- Pluralization: Schema names are pluralized by appending 's', which may not be grammatically correct for all words
- Schema naming: Full schema names (including namespace/prefix) are preserved in field names (
olm.bundle→olmbundles, notbundles) - POST only: GraphQL endpoint only accepts POST requests, unlike the metas endpoint which supports GET
- Alpha stability: API may change in future releases while in alpha
The GraphQL endpoint is controlled by the GraphQLCatalogQueries feature gate. To enable it:
args:
- --feature-gates=GraphQLCatalogQueries=trueSee enable webhook support for more details on configuring feature gates.