Move webhooks out of exp/api/v1beta1#6280
Conversation
fa24cd5 to
0e3eea6
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6280 +/- ##
==========================================
- Coverage 43.95% 43.84% -0.11%
==========================================
Files 289 289
Lines 25351 25346 -5
==========================================
- Hits 11143 11114 -29
- Misses 13435 13458 +23
- Partials 773 774 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
LGTM label has been added. DetailsGit tree hash: 317aa06247659a98142013b4a7184bbf6fc72f09 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: willie-yao The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
@mboersma: The following tests failed, say
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. DetailsInstructions 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-sigs/prow repository. I understand the commands that are listed here. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Mirrors #6141 for the
exp/api/v1beta1tree. Webhook code (validation + defaulting) and the supporting default-helpers move out of the API types package into purpose-built internal packages, leavingexp/api/v1beta1to hold types and conversions only.internal/exp/api/v1beta1/holds theSet*defaulters as free functions taking*infrav1exp.AzureMachinePool(was receiver methods on the type).internal/exp/webhooks/holds theAzureMachinePoolWebhookandAzureMachinePoolMachineWebhooktypes plus the per-validator helpers.ValidateAzureMachinePool(old, amp, client)is exported so the existing external test inexp/api/v1beta1/azuremachinepool_test.go(packagev1beta1_test) can keep covering the validators directly.main.goregisters the webhooks from the new package.Makefileaddspaths=./internal/exp/webhooks/...to thegenerate-manifestscontroller-gen invocation.config/webhook/manifests.yamlis byte-identical before and after — the same kubebuilder markers in their new home produce the same admission config.exp/controllers/azuremachinepool_reconciler.gonow callsapiinternalexp.SetNetworkInterfacesDefaults(s.scope.AzureMachinePool)instead of the receiver method.exp/api/v1beta1/azuremachinepool_default.go,azuremachinepool_default_test.go,azuremachinepool_webhook.go,azuremachinepool_webhook_test.go,azuremachinepoolmachine_webhook.go. Git detected these as renames.//nolint:staticcheckannotations on accesses to deprecatedRoleAssignmentName,SubnetName, andAcceleratedNetworkingmirror what #6141 added ininternal/api/v1beta1/azuremachine_default.go— they're necessary because reading those fields from outside their defining package now triggers SA1019.Which issue(s) this PR fixes:
Fixes #6167
Special notes for your reviewer:
The diff looks large but the bulk is mechanical: methods on
*AzureMachinePoolbecome free functions, and tests update their call-sites accordingly. The only behavioral change is the new package layout — all admission webhook semantics are unchanged (verified by the byte-identicalconfig/webhook/manifests.yaml).TODOs:
Release note: