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

Conversion webhook #1302

Merged

Conversation

qu1queee
Copy link
Contributor

@qu1queee qu1queee commented May 17, 2023

Changes

  • Add Functions required by the conversion webhook to do the conversion from v1beta1 to v1alpha1. For the conversion, as this is based on the types, we need this functions per each type. Applies to Build, BuildRun, BuildStrategy and ClusterBuildStrategy.
  • Add conversion webhook code to invoke above conversion functions
  • Add automation to generate CABundle for the webhook definition in the CRD's
  • Add unit-tests to cover conversion functions
  • Ensure v1beta1 CRDs are served, for all Custom Resources.

Fixes #1104

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

Release Notes

Introduce conversion-webhook to convert SHP Custom Resources from  v1beta1 to v1alpha1.

@qu1queee qu1queee added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/design Categorizes issue or PR as related to design. labels May 17, 2023
@openshift-ci openshift-ci bot added the release-note Label for when a PR has specified a release note label May 17, 2023
@qu1queee qu1queee force-pushed the qu1queee/conversion_webhook branch 3 times, most recently from 69ae8dd to 1299ebf Compare May 29, 2023 17:30
@qu1queee qu1queee force-pushed the qu1queee/conversion_webhook branch from ad5ac86 to 50c1881 Compare June 5, 2023 16:27
@otaviof otaviof self-assigned this Jun 13, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 27, 2023
@qu1queee qu1queee force-pushed the qu1queee/conversion_webhook branch from 04fcfb3 to 88bd994 Compare August 2, 2023 05:29
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 2, 2023
@qu1queee qu1queee force-pushed the qu1queee/conversion_webhook branch from eeaeb3d to af245c1 Compare August 3, 2023 12:21
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 3, 2023
@qu1queee qu1queee force-pushed the qu1queee/conversion_webhook branch from 42c1b08 to 7aff8b7 Compare August 4, 2023 15:50
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 14, 2023
@qu1queee qu1queee changed the title Conversion webhook Hub and Spokes functions Conversion webhook Aug 14, 2023
@qu1queee qu1queee force-pushed the qu1queee/conversion_webhook branch 3 times, most recently from d8f2aad to c7322d6 Compare August 14, 2023 12:40
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2023
@qu1queee qu1queee force-pushed the qu1queee/conversion_webhook branch 5 times, most recently from 55dfc96 to 3f2443e Compare August 15, 2023 09:47
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 25, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adambkaplan

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 25, 2023
@coreydaley
Copy link
Member

@qu1queee It looks like this pull request needs a rebase before we can merge it.

pkg/apis/build/v1beta1/buildrun_conversion.go Outdated Show resolved Hide resolved
Comment on lines 125 to 127
if brStep.SecurityContext != nil {
step.SecurityContext = brStep.SecurityContext
}
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need the nil check here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cant recall, isn't needed, same for the BuildStrategySpec.SecurityContext validation.

Modify the v1beta1 CR types
@qu1queee qu1queee force-pushed the qu1queee/conversion_webhook branch 8 times, most recently from 38398ac to fd85ac1 Compare August 30, 2023 20:08
@qu1queee
Copy link
Contributor Author

qu1queee commented Aug 30, 2023

@adambkaplan I replied to your feedback, I took the liberty to resolve all conversations where I satisfied your request. Pls take a look.

Add deployment artifacts for the webhook
Add additional hack scripts, needed for patching
the CRDs and generating a CABundle
Introduce cmd/shipwright-build-webhook
Introduce conversion pkg
Add Build CR conversion functions
For build, buildruns.
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

I have a few more smaller comments (such as not logging the admissionresponse on info but on debug level), but we can address those separately.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 1, 2023
@openshift-merge-robot openshift-merge-robot merged commit eb3506a into shipwright-io:main Sep 1, 2023
12 checks passed
@qu1queee qu1queee deleted the qu1queee/conversion_webhook branch September 1, 2023 13:24
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. kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BETA API] Implement conversion webhook for alpha-beta transformation
6 participants