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

✨ (go/v4): Add Hub and Spoke for conversion webhooks #4254

Merged
merged 1 commit into from
Nov 30, 2024

Conversation

camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Oct 30, 2024

This PR introduces support for scaffolding a conversion webhook with a hub-and-spoke model in Kubebuilder Go plugin (v4). The feature allows defining one hub version with one or many spoke versions for seamless conversion between CustomResourceDefinition (CRD) API versions.

How It Will Work:

Users can:

kubebuilder create webhook --group example.com --version v1 --kind MyKind --conversion --spoke v2

OR

kubebuilder create webhook --group example.com --version v1 --kind MyKind --conversion --spoke v2,v3

Closes; #2589

@k8s-ci-robot
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

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 30, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 30, 2024
@camilamacedo86 camilamacedo86 force-pushed the huc-spoke branch 2 times, most recently from 7027ba2 to 0941851 Compare October 31, 2024 18:13
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 31, 2024
@camilamacedo86 camilamacedo86 force-pushed the huc-spoke branch 2 times, most recently from efe33fd to 7216ea6 Compare October 31, 2024 19:10
@camilamacedo86 camilamacedo86 marked this pull request as ready for review October 31, 2024 19:10
@camilamacedo86 camilamacedo86 changed the title WIP: Changes Webhooks - Add Hub and Spoke ✨ Add Hub and Spoke for conversion webhooks Oct 31, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 31, 2024
@camilamacedo86 camilamacedo86 force-pushed the huc-spoke branch 8 times, most recently from 8b2b36d to 233645d Compare November 1, 2024 17:00
@camilamacedo86 camilamacedo86 changed the title ✨ Add Hub and Spoke for conversion webhooks ✨ (kustomize/v2, go/v4): Add Hub and Spoke for conversion webhooks Nov 2, 2024
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this pull request Nov 2, 2024
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize.

However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.

**Note:** This change only affects projects that require a **conversion webhook**.
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this pull request Nov 2, 2024
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize.

However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.

**Note:** This change only affects projects that require a **conversion webhook**.
@camilamacedo86 camilamacedo86 force-pushed the huc-spoke branch 2 times, most recently from 501e28c to cc242e6 Compare November 10, 2024 18:10
@camilamacedo86 camilamacedo86 changed the title (WIP - We need to address the review comments) ✨ (kustomize/v2, go/v4): Add Hub and Spoke for conversion webhooks ✨ (kustomize/v2, go/v4): Add Hub and Spoke for conversion webhooks Nov 10, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 10, 2024
@camilamacedo86 camilamacedo86 force-pushed the huc-spoke branch 2 times, most recently from dd213e6 to be62108 Compare November 10, 2024 19:39
@camilamacedo86 camilamacedo86 changed the title ✨ (kustomize/v2, go/v4): Add Hub and Spoke for conversion webhooks ✨ (go/v4): Add Hub and Spoke for conversion webhooks Nov 10, 2024
@camilamacedo86 camilamacedo86 force-pushed the huc-spoke branch 2 times, most recently from e039767 to 9a11598 Compare November 10, 2024 19:44
@camilamacedo86
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 10, 2024
@camilamacedo86 camilamacedo86 force-pushed the huc-spoke branch 2 times, most recently from c047d72 to 2454643 Compare November 24, 2024 09:14
This commit introduces support for the conversion webhook by adding a hub and spoke implementation.
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this pull request Nov 24, 2024
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize.

However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.

**Note:** This change only affects projects that require a **conversion webhook**.
Copy link
Member

@varshaprasad96 varshaprasad96 left a comment

Choose a reason for hiding this comment

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

Thanks @camilamacedo86! Tested this out, and this looks good!
/lgtm
/approve

pkg/model/resource/webhooks.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 30, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, varshaprasad96

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:
  • OWNERS [camilamacedo86,varshaprasad96]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@camilamacedo86 camilamacedo86 merged commit 781e93f into kubernetes-sigs:master Nov 30, 2024
24 of 26 checks passed
@camilamacedo86 camilamacedo86 deleted the huc-spoke branch November 30, 2024 21:37
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this pull request Dec 1, 2024
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize.

However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.

**Note:** This change only affects projects that require a **conversion webhook**.
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this pull request Dec 1, 2024
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize.

However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.

**Note:** This change only affects projects that require a **conversion webhook**.
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this pull request Dec 1, 2024
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize.

However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.

**Note:** This change only affects projects that require a **conversion webhook**.
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this pull request Dec 1, 2024
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize.

However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.

**Note:** This change only affects projects that require a **conversion webhook**.
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this pull request Dec 1, 2024
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize.

However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.

**Note:** This change only affects projects that require a **conversion webhook**.
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

3 participants