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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 Move experimental addons API v1beta1 webhooks to separate package #9438

Merged

Conversation

Ankitasw
Copy link
Member

@Ankitasw Ankitasw commented Sep 15, 2023

What this PR does / why we need it:

To work towards #9011, we need to remove the reliance on controller-runtime from the API packages.
This updates the webhooks to use the CustomDefaulter and CustomValidator pattern and moves them to match the Cluster and ClusterClass webhooks. This Is a more major lift but removes quite a bit of the code from the API package itself, making it's reliance on controller-runtime a lot smaller.

Which issue(s) this PR fixes (optional, in fixes #(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area PR is missing an area label labels Sep 15, 2023
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 15, 2023
@Ankitasw Ankitasw changed the title Move experimental addons API v1beta1 webhooks to separate package 馃尡 Move experimental addons API v1beta1 webhooks to separate package Sep 15, 2023
@Ankitasw
Copy link
Member Author

/area api

@k8s-ci-robot k8s-ci-robot added area/api Issues or PRs related to the APIs and removed do-not-merge/needs-area PR is missing an area label labels Sep 15, 2023
@Ankitasw Ankitasw force-pushed the move-exp-addons-webhooks branch 4 times, most recently from cc7ef5a to f4fdd0b Compare September 15, 2023 09:53
@Ankitasw
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

@Ankitasw
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Just some context.

The idea is that for an update call on an object our ValidateUpdate func is called and we get the old and the new object.
Usually we only need the old object if we e.g. want to compare old and new or if it is important how the previous object looked like.

In ValidateCreate we only get one object, the one that is created. We have to pass this into the validation as the "newObj" as the newObj is the one where we usually run the full validation on, while the oldObj is only used for "update" checks

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 15, 2023
@Ankitasw
Copy link
Member Author

Ankitasw commented Sep 15, 2023

@sbueringer thankyou for detailed review. I have incorporated those comments, PTAL.

@Ankitasw Ankitasw force-pushed the move-exp-addons-webhooks branch 4 times, most recently from 3b84957 to a1c6db7 Compare September 15, 2023 15:28
@Ankitasw
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Thank you. Last round of nits

@Ankitasw
Copy link
Member Author

PR is ready for review.

@k8s-ci-robot
Copy link
Contributor

@Ankitasw: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-apidiff-main 4f32c4f link false /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@chrischdi
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 19, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: d306ebb91b5602ce5349266a4dc847c3648f71b8

@sbueringer
Copy link
Member

Thank you!

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 19, 2023
@k8s-ci-robot k8s-ci-robot merged commit 1ab45a6 into kubernetes-sigs:main Sep 19, 2023
25 of 26 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.6 milestone Sep 19, 2023
@Ankitasw Ankitasw deleted the move-exp-addons-webhooks branch September 19, 2023 09:32
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. area/api Issues or PRs related to the APIs 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/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.

None yet

4 participants