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

✨ Add OpenAPI Schema support to virtual workspace framework #3059

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

palnabarun
Copy link
Member

Summary

Add OpenAPI Schema support to virtual workspace framework.

The implementation taps into the CreateServingInfo path to generate the spec and adds a handler to VW apiserver for handling the request and updating the OpenAPI v3 service caches.

TODO: OpenAPI v2 support and structuring the code for merge.

Related issue(s)

None

Release Notes

TODO: Before merge.

@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. labels Dec 12, 2023
@kcp-ci-bot
Copy link
Contributor

[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 sttts for approval. For more information see the Kubernetes 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

@kcp-ci-bot kcp-ci-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 12, 2023
@kcp-ci-bot
Copy link
Contributor

Hi @palnabarun. Thanks for your PR.

I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@palnabarun palnabarun force-pushed the vw-openapi branch 2 times, most recently from 9e78baa to 07deb4f Compare December 12, 2023 13:27
for gvr, apiDefinition := range apiSet {
if group == "" || (group != "" && group == gvr.Group) {
spec := apiDefinition.GetOpenAPIV3Spec()
h.openAPIV3Service.UpdateGroupVersion(gvr.Group, spec)
Copy link
Member

Choose a reason for hiding this comment

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

is this synchronous?

Copy link
Member Author

Choose a reason for hiding this comment

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

It lazily updates the cache, IIUC.

@sttts
Copy link
Member

sttts commented Dec 12, 2023

Can you add an e2e test? Am interested to see the schema for exported and claimed resources (both APIResourceSchemas and native resources) of an APIExport.

@mjudeikis mjudeikis changed the title 📝 Add OpenAPI Schema support to virtual workspace framework ✨ Add OpenAPI Schema support to virtual workspace framework Dec 13, 2023
@palnabarun
Copy link
Member Author

Can you add an e2e test? Am interested to see the schema for exported and claimed resources (both APIResourceSchemas and native resources) of an APIExport.

@sttts Sure. I will explore the tests. Can you also add the ok-to-test label so that the usual tests run on the PR?

@sttts
Copy link
Member

sttts commented Dec 14, 2023

/ok-to-test

@kcp-ci-bot kcp-ci-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 14, 2023
Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>
@xrstf
Copy link
Contributor

xrstf commented Apr 8, 2024

I think I might need this. I'm trying to implement a virtual workspace using the fixedgvs abstraction, but it keeps blowing up with "OpenAPIV3 config must not be nil".

@@ -330,3 +332,86 @@ func sortGroupDiscoveryByKubeAwareVersion(gd []metav1.GroupVersionForDiscovery)
return version.CompareKubeAwareVersionStrings(gd[i].Version, gd[j].Version) > 0
})
}

type openAPIHandler struct {
Copy link
Member

Choose a reason for hiding this comment

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

can you describe on the high level how this handler gets a v3 schema for the right resources?

Copy link
Member

Choose a reason for hiding this comment

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

go doc I mean

w, r)
}

h.openAPIV3Service.HandleGroupVersion(w, r)
Copy link
Member

Choose a reason for hiding this comment

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

If I am not mistaken, die service is not workspace and binding aware.

@kcp-ci-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
After a furter 30 days, they will turn rotten.
Mark the issue as fresh with /remove-lifecycle stale.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@kcp-ci-bot kcp-ci-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 10, 2024
@embik
Copy link
Member

embik commented Jul 11, 2024

/remove-lifecycle stale

@kcp-ci-bot kcp-ci-bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 11, 2024
@embik
Copy link
Member

embik commented Aug 8, 2024

Hey @palnabarun, the 1.30 rebase is done now. Would you be interested in picking up this work again?

@kcp-ci-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
After a furter 30 days, they will turn rotten.
Mark the issue as fresh with /remove-lifecycle stale.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@kcp-ci-bot kcp-ci-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has signed the DCO. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants