kubernetes-sigs / cluster-api-provider-openstack

Cluster API implementation for OpenStack
https://cluster-api-openstack.sigs.k8s.io/
Apache License 2.0
292 stars 253 forks source link

🌱 Move webhooks into pkg/webhooks #1920

Closed mdbooth closed 7 months ago

mdbooth commented 7 months ago

Moves webhooks from api to pkg/webhooks making only mechanical code changes except for:

The former results in there now being no mutating webhook configured.

/hold

k8s-ci-robot commented 7 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mdbooth

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](https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/OWNERS)~~ [mdbooth] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
netlify[bot] commented 7 months ago

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
Latest commit cb09d5fe452bd6c2b24dfa1b10c35b8c65b92164
Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/65e637e917bdc80008f33a00
Deploy Preview https://deploy-preview-1920--kubernetes-sigs-cluster-api-openstack.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

mdbooth commented 7 months ago

Probably not necessary here, but: /test pull-cluster-api-provider-openstack-e2e-full-test

mdbooth commented 7 months ago

I think we still need to define webhooks for the list types even if they don't implement a validator or defaulter, because they will implicitly register a conversion webhook.

mdbooth commented 7 months ago

/test pull-cluster-api-provider-openstack-e2e-full-test

mdbooth commented 7 months ago

The e2e tests were failing because I had added a conversion webhook for OpenStackClusterTemplateList which was not previously present. I added it because it looked like an accidental omission, but it turns out that:

This also explains why the API validation tests weren't failing, because they weren't registering old API versions in the test scheme. I've fixed this by:

I've left these things as separate commits because they're logically separate changes. However, they are all required for the tests to pass on this PR.

mdbooth commented 7 months ago

/test pull-cluster-api-provider-openstack-e2e-full-test

mdbooth commented 7 months ago

Given that the full test passed, I'm guessing that could have been a flake.

/retest-required

JoelSpeed commented 7 months ago

/lgtm

Big step in the right direction towards decoupling API types from imports, LGTM

mdbooth commented 7 months ago

/hold cancel