Skip to content

Commit 41f501b

Browse files
committed
review comments, s/query/meta facelift, resource and maturity
Signed-off-by: Jordan Keister <[email protected]>
1 parent 27cfe0c commit 41f501b

File tree

1 file changed

+120
-35
lines changed

1 file changed

+120
-35
lines changed

enhancements/olm/catalogd-query-endpoint.md renamed to enhancements/olm/catalogd-console-api.md

Lines changed: 120 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
---
2-
title: catalogd-query-endpoint
2+
title: catalogd-console-api
33
authors:
44
- @grokspawn
55
- @anik120
66
reviewers: # Include a comment about what domain expertise a reviewer is expected to bring and what area of the enhancement you expect them to focus on. For example: - "@networkguru, for networking aspects, please look at IP bootstrapping aspect"
7-
- TBD
7+
- @spadgett, for OCP console
8+
- @jhadvig, for OCP console
9+
- @TheRealJon, for OCP console
10+
- @joelanford, for OLM
11+
- @eggfoobar, for SNO
12+
- @csrwng, for Hypershift
813
approvers: # A single approver is preferred, the role of the approver is to raise important questions, help ensure the enhancement receives reviews from all applicable areas/SMEs, and determine when consensus is achieved such that the EP can move forward to implementation. Having multiple approvers makes it difficult to determine who is responsible for the actual approval.
9-
- TBD
14+
- @spadgett
1015
api-approvers: # In case of new or modified APIs or API extensions (CRDs, aggregated apiservers, webhooks, finalizers). If there is no API change, use "None"
11-
- TBD
16+
- None
1217
creation-date: 2025-01-30
13-
last-updated: 2025-01-30
18+
last-updated: 2025-02-11
1419
tracking-link: # link to the tracking ticket (for example: Jira Feature or Epic ticket) that corresponds to this enhancement
1520
- https://issues.redhat.com/browse/OPRUN-3688
1621
see-also:
@@ -46,13 +51,15 @@ See ../README.md for background behind these instructions.
4651
Start by filling out the header with the metadata for this enhancement.
4752
-->
4853

49-
# catalogd-query-api
54+
# catalogd-console-api
5055

5156
## Summary
5257

5358
Catalogd currently supports an HTTPS endpoint to access file-based catalog (FBC) contents
54-
but the endpoint provides complete catalog content in a single transaction.
55-
We would like to introduce a new HTTPS endpoint to provide more fine-grained access to
59+
but the endpoint provides complete catalog content in a single transaction. In performance testing with
60+
proof of concept OCP console work, it proves insufficiently responsive and requires user-agent-side results
61+
caching of large amounts of catalog data.
62+
We would like to introduce a new HTTPS endpoint to provide more fine-grained and lower-latency access to
5663
catalog contents.
5764

5865
<!--
@@ -72,7 +79,7 @@ This section is for explicitly listing the motivation, goals and non-goals of
7279
this proposal. Describe why the change is important and the benefits to users.
7380
-->
7481

75-
The existing `/api/v1/all` endpoint returns the entire FBC, which the clients then need
82+
The existing `/api/v1/all` endpoint returns the entire FBC, which console or other clients then need
7683
to process in order to retrieve relevant information. This is very inefficient for
7784
accesses which can be satisfied by a much smaller record set.
7885

@@ -84,16 +91,25 @@ operatorhub.io: 21MB <--- the benchmark 4-10s duration
8491
redhat-marketplace-index: 9MB
8592
-->
8693

87-
Requiring clients to retrieve the full catalog can also result in a 4-10 second delay _per catalog_ even under optimal network conditions.
94+
Requiring OCP console to make the full catalog available to users incurs a 4-10 second delay _per catalog_ even
95+
under optimal network conditions, plus large local cache coherency challenges to avoid additional retrievals to
96+
fulfill further use-cases as a user makes progress towards selecting content to install.
8897

8998

9099
### User Stories
91100

92-
* As a catalog client, I want to be able to pose space-efficient catalog queries
101+
* As a console user, I would like to be able to discover available packages for installation.
102+
* As a console user, I would like to be able to request only catalog context relevant to a specific package.
103+
* As a console user, I would like to be able to discover available package updates.
104+
* As a console user, I would like to be able to view details for a specific channel for a package.
105+
* As a console user, I would like to be able to discover all bundle versions associated with a package
106+
(and optionally a specific channel).
107+
* As a console user, I would like to be able to view details for a specific bundle version.
108+
93109

94110
### Goals
95111

96-
* Provide an HTTPS endpoint which fulfills targeted catalog queries with a minimum record set.
112+
* Provide an HTTPS catalog content discovery endpoint which fulfills targeted catalog queries with a minimum record set.
97113

98114
<!--
99115
Summarize the specific goals of the proposal. How will we know that
@@ -119,7 +135,9 @@ enhancement.
119135

120136
## Proposal
121137

122-
This proposal introduces an additional HTTPS endpoint to an existing catalogd API. The existing HTTPS "all" endpoint will remain as a default option; the user will be able to enable this new capability via a feature gate.
138+
This proposal introduces an additional HTTPS endpoint to an existing catalogd API.
139+
The existing HTTPS "all" endpoint will remain as a default option; the user will be
140+
able to enable this new capability via a feature gate.
123141

124142
<!--
125143
This section should explain what the proposal actually is. Enumerate
@@ -137,7 +155,12 @@ the document.
137155

138156
### Workflow Description
139157

140-
To serve curated data from the FBC, a new HTTPS endpoint will be exposed by the existing service under the base URL as detailed in `API Specification`. The new endpoint will be derived from `.status.urls.base` following the pattern `/api/v1/query?[...parameters]` and will accept parameters which correspond to any of the fields of the `declcfg.Meta` catalog [atomic type](https://github.com/operator-framework/operator-registry/blob/e15668c933c03e229b6c80025fdadb040ab834e0/alpha/declcfg/declcfg.go#L111):
158+
To serve curated data from the FBC, a new HTTPS endpoint will be exposed by
159+
the existing service under the base URL as detailed in `API Specification`.
160+
The new endpoint will be derived from `.status.urls.base` following the pattern
161+
`/api/v1/metas?[...parameters]` and will accept parameters which correspond to
162+
any of the fields of the `declcfg.Meta` catalog
163+
[atomic type](https://github.com/operator-framework/operator-registry/blob/e15668c933c03e229b6c80025fdadb040ab834e0/alpha/declcfg/declcfg.go#L111):
141164

142165
```golang
143166
type Meta struct {
@@ -147,7 +170,8 @@ To serve curated data from the FBC, a new HTTPS endpoint will be exposed by the
147170
}
148171
```
149172
Query parameters will be logically ANDed and used to restrict response scope.
150-
This API will be conditionally enabled by an upstream `APIV1QueryEndpoint` feature gate as part of a downstream `NewOLM{suffix}` style OCP TP feature gate, and will be disabled by default.
173+
This API will be conditionally enabled by an upstream `APIV1MetasEndpoint`
174+
feature gate as part of a downstream `NewOLM{suffix}` style feature gate.
151175

152176
<!--
153177
Explain how the user will use the feature. Be detailed and explicit.
@@ -209,24 +233,24 @@ info:
209233
version: 1.0.0
210234
description: ""
211235
paths:
212-
/{baseURL}/api/v1/query:
236+
/{baseURL}/api/v1/metas:
213237
get:
214238
parameters:
215239
- name: name
216240
description: query by declcfg.Meta.name
217241
schema:
218242
type: string
219-
in: query
243+
in: metas
220244
- name: package
221245
description: query by declcfg.Meta.package
222246
schema:
223247
type: string
224-
in: query
248+
in: metas
225249
- name: schema
226250
description: query by declcfg.Meta.schema
227251
schema:
228252
type: string
229-
in: query
253+
in: metas
230254
responses:
231255
"200":
232256
headers:
@@ -306,16 +330,31 @@ how the code will be rewritten in the enhancement.
306330
307331
### Caching Considerations
308332
309-
This proposal indends to provide RFC7234 caching compliance through support for `Last-Modified` and `If-Modified-Since` directives. Clients can use these headers to avoid re-downloading unchanged data.
333+
This proposal indends to provide RFC7234 caching compliance through support for `Last-Modified` and
334+
`If-Modified-Since` directives. Clients can use these headers to avoid re-downloading unchanged data.
310335
The server will respond with 304 Not Changed if the catalog metadata is unchanged.
311336

312337
Clients are also encouraged to implement local caching for frequently queried metadata.
313338

339+
### Resource Considerations
340+
341+
This proposal should have no impact on
342+
SNO [resource minimums](https://docs.openshift.com/container-platform/4.17/installing/installing_sno/install-sno-preparing-to-install-sno.html#install-sno-requirements-for-installing-on-a-single-node_install-sno-preparing)
343+
- vCPU: 8
344+
- RAM: 16GiB
345+
- storage: 120GiB
346+
347+
or Hypershift [SLOs](https://hypershift-docs.netlify.app/reference/slos/) where the primary consideration is memory uses in the 10s of MiB, not 100s.
314348

315349
### Risks and Mitigations
316350

317-
Depending on the implementation of this proposal, exercise of this endpoint could function as an I/O multiplier which could starve other clients which are dependent on the same API.
318-
The first iteration of this endpoint will not attempt to mitigate denial-of-service attempts via rate-limiting or other resource consumption constraints.
351+
Depending on the implementation of this proposal, exercise of this endpoint could function as an
352+
I/O multiplier which could starve other clients which are dependent on the same API.
353+
The first iteration of this endpoint will not attempt to mitigate denial-of-service attempts via
354+
rate-limiting or other resource consumption constraints.
355+
356+
The proposal does not include any provision for authentication/authorization, since there are no
357+
current use-cases which require it.
319358

320359
<!--
321360
What are the risks of this proposal and how do we mitigate. Think broadly. For
@@ -331,11 +370,32 @@ Consider including folks that also work outside your immediate sub-project.
331370

332371
### Drawbacks
333372

334-
Given the highly-variable nature of responses based on unbound combinations of schema/name/package, any server-side caching will be problematic if not completely impractical. Read: computationally and/or storage expensive.
373+
#### Caching
374+
Given the highly-variable nature of responses based on unbound combinations of schema/name/package,
375+
any server-side caching will be problematic if not completely impractical. Read: computationally and/or
376+
storage expensive.
377+
378+
For example, response for `metas?schema=olm.package&name=foo` and `metas?schema=olm.package&name=bar`
379+
represent disjoint sets, and the server would have to either ignore `If-Modified-Since` directives
380+
in client requests or rely on their veracity uncritically.
381+
382+
Further, if the underlying implementation relies on anything other than a dictionary of cached requests
383+
(&parameters) to dictate date-relevant responses (for e.g. relying on the catalog unpack time),
384+
then any server-side caching would be erroneous.
385+
386+
The existing `all` endpoint also incentivizes clients to conserve resources via local cache to avoid making
387+
many (potentially duplicate) requests. However, the OCP console proof of concept
388+
required what was deemed an unsupportable amount of code and complexity to cache, decompose, and render the
389+
complete FBC.
335390

336-
For example, response for `query?schema=olm.package&name=foo` and `query?schema=olm.package&name=bar` represent disjoint sets, and the server would have to either ignore `If-Modified-Since` directives in client requests or rely on their veracity uncritically.
391+
#### Complexity
392+
Server implementation is much more complex and resource intensive due to the need to index catalog
393+
content and serve variable requests.
394+
395+
#### Completeness
396+
The previous `all` endpoint always returns valid FBC. The new service cannot make that promise,
397+
so clients could make incorrect assumptions about the suitability of results. See Open Questions.
337398

338-
Further, if the underlying implementation relies on anything other than a dictionary of cached requests (&parameters) to dictate date-relevant responses (for e.g. relying on the catalog unpack time), then any server-side caching would be erroneous.
339399

340400
<!--
341401
The idea is to find the best form of an argument why this enhancement should
@@ -357,18 +417,18 @@ to implement the design. For instance,
357417
> 1. This requires exposing previously private resources which contain sensitive
358418
information. Can we do this?
359419
-->
360-
> 1. If a query comes in with `/api/v1/query?package=foo`, should we include the blob with schema: `olm.package` and name: `foo`?
420+
> 1. If a query comes in with `/api/v1/metas?package=foo`, should we include the blob with schema: `olm.package` and name: `foo`?
361421

362-
We feel that it is incorrect for the query service endpoint to mutate the data model (specifically, to create a synthetic package attribute for the `olm.package` schema). To access all the data modeled for an installable package, separate queries need to be made for the package-level metadata (`schema=olm.package&name=foo`) versus the channel/bundle-level metadata (`package=foo`).
422+
We feel that it is incorrect for the metas service endpoint to mutate the data model (specifically, to create a synthetic package attribute for the `olm.package` schema). To access all the data modeled for an installable package, separate queries need to be made for the package-level metadata (`schema=olm.package&name=foo`) versus the channel/bundle-level metadata (`package=foo`).
363423

364-
> 2. What guarantees do we make about the response bodies of all and query?
365-
> - all and query return a stream of valid FBC blobs
424+
> 2. What guarantees do we make about the response bodies of `all` and `metas`?
425+
> - `all` and `metas` return a stream of valid FBC blobs
366426
> - Does catalogd make any guarantee that all passes opm validate-style validation?
367-
> - We definitely can't guarantee that query responses pass opm validate-style validation.
427+
> - We definitely can't guarantee that `metas` responses pass opm validate-style validation.
368428
> - Do we need to clarify that it is up to clients to verify semantic validity if they need it? Are we comfortable putting that burden on clients?
369429

370430
`all` responses will preserve existing validity of the catalog data both from an installably-complete perspective (can be used as an installation reference) as well as syntactically valid perspective (opm validate).
371-
`query` responses will be valid `declcfg.Meta` elements and make no promise that the response may be installably-complete (in the sense that the response itself could be used as a fully-intact catalog) or syntactically valid.
431+
`metas` responses will be valid `declcfg.Meta` elements and make no promise that the response may be installably-complete (in the sense that the response itself could be used as a fully-intact catalog) or syntactically valid.
372432

373433
## Test Plan
374434

@@ -390,6 +450,23 @@ expectations).
390450
## Graduation Criteria
391451

392452
**Note:** *Section not required until targeted at a release.*
453+
454+
### Tech Preview
455+
- Initial implementation is protected by the default-disabled feature gate `APIV1MetasEndpoint`.
456+
- Sufficient test coverage
457+
- Feedback from OCP Console team.
458+
- e2e feature tests are enabled for TPNU clusters.
459+
- origin tests demonstrating endpoint inaccessibility in non-TPNU clusters
460+
- resource benchmarking
461+
462+
### Tech Preview --> GA
463+
- announce deprecation schedule for `all` endpoint.
464+
- feature gate moves to default-enabled
465+
- collect test data for coverage / reliability
466+
467+
### GA --> Maturity
468+
- remove feature gate
469+
393470
<!--
394471
Define graduation milestones.
395472

@@ -563,18 +640,26 @@ Describe how to
563640

564641
- Do nothing
565642

566-
This option would require clients to query the entirety of the data (~21 MB for operatorhubio catalog) and parse the response to retrieve relevant information every time the client needs the data. Even if clients’ implement some form of caching, the first query the client does to catalogd server is still the dealbreaker. In a highly resource constrained environment (e.g. clusters in Edge devices), this basically translates to a chokepoint for the clients to get started.
643+
This option would require clients to query the entirety of the data (~21 MB for operatorhubio
644+
catalog) and parse the response to retrieve relevant information every time the client
645+
needs the data. Even if clients’ implement some form of caching, the first query the client
646+
does to catalogd server is still the dealbreaker. In a highly resource constrained environment
647+
(e.g. clusters in Edge devices), this basically translates to a chokepoint for the clients to get started.
567648

568649
- A “path hierarchy” based construction of API endpoints to expose filtered FBC metadata
569650

570-
The alternative to exposing a single, parameterized query endpoint is exposing many, “path hierarchy” based API endpoints. Eg:
651+
The alternative to exposing a single, parameterized query endpoint is exposing many, “path
652+
hierarchy” based API endpoints. Eg:
571653

572654
/api/v1/catalogs/operatorhubio/packages/, /api/v1/catalogs/operatorhubio/packages/<package-name>/, /api/v1/catalogs/operatorhubio/packages/<package-name>/bundles/
573655
etc.
574656

575-
This interface creates a new API on top of the existing FBC structure. It also increases the number of discoverable endpoints by clients, with the scope for an unsustainable expansion of the API surface area in the future.
657+
This interface creates a new API on top of the existing FBC structure. It also increases
658+
the number of discoverable endpoints by clients, with the scope for an unsustainable
659+
expansion of the API surface area in the future.
576660

577-
The main approach proposed in this document instead uses the already existing “FBC API”, with a clean API surface area
661+
The main approach proposed in this document instead uses the already existing “FBC API”, with
662+
a clean API surface area.
578663

579664

580665
<!--

0 commit comments

Comments
 (0)