Skip to content
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

✨ Implement cluster-aware OpenAPI v3 #3118

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

sttts
Copy link
Member

@sttts sttts commented Apr 18, 2024

Summary

The OpenAPI v3 stack was not yet cluster-aware. This PR adds

  1. a controller generating and caching OpenAPI v3 specs for all CRDs, including bound CRD for APIBindings
  2. a filter WithOpenAPIv3 that merges these specs on-demand keeping a cache for different API configurations.

It makes heavy use of the lazy evaluation to avoid computation where possible.

Currently, (2) is implemented with a LRU cache of size 100 holding the (lazily) merged specs for API configurations. This means that with more than a 100 different configurations and constant OpenAPI v3 requests, this will not work well. Either we increase the number of different API configurations in the cache, or we use another kind of cache. But it's probably not common that there are so many different API configurations because some workspace types will be reused a lot.

Release Notes

Add support for /openapi/v3 endpoints for workspaces with awareness of static resources, CRDs and APIBindings.

@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 18, 2024
@sttts sttts force-pushed the sttts-openapi-v3 branch 8 times, most recently from fc32b88 to 63bea95 Compare April 18, 2024 16:11
Copy link
Contributor

@mjudeikis mjudeikis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Want to test "in prod"?
Do you think it worth a feature-gate so we can test in isolation and turn it off if needed?

pkg/server/openapiv3/controller.go Outdated Show resolved Hide resolved
pkg/server/openapiv3/controller.go Show resolved Hide resolved
pkg/server/openapiv3/servicecache.go Show resolved Hide resolved
@mjudeikis
Copy link
Contributor

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 19, 2024
@kcp-ci-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: c50d4ec07fb934eb7538864632f46652bd931bd3

@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mjudeikis

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

The pull request process is described 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

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2024
@kcp-ci-bot kcp-ci-bot merged commit 8f8fe3d into kcp-dev:main Apr 19, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants