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

✨ Webhook URL based CRD conversions #3090

Merged
merged 5 commits into from
Apr 3, 2024

Conversation

palnabarun
Copy link
Member

@palnabarun palnabarun commented Mar 14, 2024

Summary

An attempt to add webhook URL based CRD conversions with/without a custom CA.

Changeset

  • Add Conversion field to APIResourceSchema and validate with CRD
  • Change apigen to support conversion
  • Update logic in apibinding reconciler to support conversions

The conversion works for CRDs created manually, just like Kubernetes. For CRDs created from API bindings, no more plumbing is required.

Related issue(s)

None

Release Notes

✨ Add Webhook URL based CRD conversions

@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Mar 14, 2024
@kcp-ci-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kcp-ci-bot kcp-ci-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 14, 2024
@palnabarun palnabarun requested a review from sttts March 14, 2024 12:16
@palnabarun palnabarun self-assigned this Mar 14, 2024
@palnabarun palnabarun marked this pull request as ready for review March 15, 2024 06:09
@kcp-ci-bot kcp-ci-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 15, 2024
@mjudeikis
Copy link
Contributor

/retest

@palnabarun palnabarun force-pushed the feat/url-based-crd-conversions branch from faabb18 to 750a91d Compare March 23, 2024 06:16
@mjudeikis
Copy link
Contributor

/lgtm

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

LGTM label has been added.

Git tree hash: d47a691bef1dde6131d5aa5ab483021e8354a343

@@ -541,5 +538,27 @@ func generateCRD(schema *apisv1alpha1.APIResourceSchema) (*apiextensionsv1.Custo
crd.Spec.Versions = append(crd.Spec.Versions, crdVersion)
}

if len(schema.Spec.Versions) > 1 && schema.Spec.Conversion == nil {
Copy link
Member

Choose a reason for hiding this comment

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

do we have validation in place that check this? Here we are pretty late in the process.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't at the moment. This should either be in admission or checked through a CEL expression in the APIResourceSchema. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

If CEL, this might be an option: size(self.versions) == 1 || (size(self.versions) > 1 && has(self.conversion))

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if one can put a Kubebuilder validation on the spec field? Never tried.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added this in the latest commit and verified by trying to create a CRD.

@kcp-ci-bot kcp-ci-bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 26, 2024
@kcp-ci-bot kcp-ci-bot requested a review from mjudeikis March 26, 2024 01:35
@kcp-ci-bot kcp-ci-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 26, 2024
…nform APIResourceSchema to CRD

Signed-off-by: Nabarun Pal <[email protected]>
@sttts
Copy link
Member

sttts commented Apr 3, 2024

/lgtm
/approve

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

LGTM label has been added.

Git tree hash: b71145a26a52ec2a9a4ff9e77124e695438ef055

@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts

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 3, 2024
@kcp-ci-bot kcp-ci-bot merged commit 99732c3 into kcp-dev:main Apr 3, 2024
17 checks passed
@palnabarun palnabarun deleted the feat/url-based-crd-conversions branch April 4, 2024 11:07
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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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.

4 participants