WIP: [IGNORE] test add v1beta2 API version#6209
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
61b422f to
5c0e317
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6209 +/- ##
==========================================
- Coverage 43.85% 35.99% -7.86%
==========================================
Files 289 345 +56
Lines 25341 30909 +5568
==========================================
+ Hits 11113 11127 +14
- Misses 13450 18998 +5548
- Partials 778 784 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c4ee9d4 to
5cce3bc
Compare
42abc3c to
d46f07c
Compare
d46f07c to
6a51259
Compare
6a51259 to
9b6f0d2
Compare
|
/retest |
1 similar comment
|
/retest |
|
/test ls |
|
/test pull-cluster-api-provider-azure-conformance-custom-builds |
|
/retest |
Create api/v1beta2/ and exp/api/v1beta2/ packages with all CAPZ type definitions updated for the CAPI v1beta2 contract. Key changes from v1beta1 types: - status.ready (bool) → status.initialization.provisioned (*bool) One-time signal that must never revert to false once set. - status.conditions (clusterv1beta1.Conditions) → status.conditions ([]metav1.Condition) Standard Kubernetes condition type at status.conditions (Stage 2). - status.failureDomains (map) → status.failureDomains ([]FailureDomain slice) - status.failureReason/failureMessage → status.deprecated.v1beta1.* - AzureManagedControlPlane uses Available condition (not Ready) per CP contract. - ControlPlaneEndpoint uses omitzero to prevent empty struct validation failures. - spec.providerID changed from *string to string on AzureMachine. This commit is purely additive — no existing code is modified. Signed-off-by: William Yao <william2000yao@gmail.com>
Add conversion-gen output and ConvertTo/ConvertFrom methods for all spoke types. Generated by conversion-gen v0.35.0 with --extra-peer-dirs for cross-package CAPI types. Types with conversion: - api/v1beta1: 17 types (core + managed + templates + ASO) - api/v1alpha1: 6 ASO managed types - exp/api/v1beta1: AzureMachinePool, AzureMachinePoolMachine This commit contains only generated code and thin wrappers.
Manual conversion for status fields that changed shape between versions:
- Ready (bool) ↔ Initialization.Provisioned (*bool)
- Initialized (bool) ↔ Initialization.ControlPlaneInitialized (*bool)
- FailureDomains map ↔ slice
- FailureReason/FailureMessage ↔ Deprecated.V1Beta1
- Conditions: v1beta1 → Deprecated.V1Beta1.Conditions
Critical roundtrip fix: CAPI's condition converters are intentional
no-ops producing zero-valued entries ({type:"",status:""}). Fix:
1. out.Conditions = nil after every autoConvert (both directions)
2. hasNonEmptyConditions() filters zero-valued artifacts
Signed-off-by: William Yao <william2000yao@gmail.com>
Configure all 19 CRDs for dual-version serving with v1beta2 as storage: - +kubebuilder:storageversion on v1beta2, removed from v1beta1 - cluster.x-k8s.io/v1beta2: v1beta2 contract label on all CRDs - Conversion webhook patches enabled for all multi-version CRDs - CA injection patches for 9 types that were previously missing - contract: v1beta2 in metadata.yaml and e2e test config Signed-off-by: William Yao <william2000yao@gmail.com>
Mechanical change: update all import paths from api/v1beta1 to api/v1beta2 (aliased as infrav1) across ~228 files. Import alias rules updated in .golangci.yml: - infrav1 → api/v1beta2, infrav1beta1 → api/v1beta1 - infrav1exp → exp/api/v1beta2, infrav1expbeta1 → exp/api/v1beta1 Signed-off-by: William Yao <william2000yao@gmail.com>
Update all 6 scope PatchObject methods for the v1beta2 contract:
1. V1beta2 conditions (Stage 2):
- conditions.SetSummaryCondition() for Ready/Available summary
- AzureCluster/Machine/Pool: Ready condition
- AzureManagedControlPlane: Available condition (per CP contract)
2. V1beta1 dual-write for backward compatibility:
- setV1Beta1ConditionsFromV1Beta2() converts v1beta2 conditions to
clusterv1.Conditions and stores in Deprecated.V1Beta1.Conditions
- patch.WithOwnedV1Beta1Conditions declares ownership
- v1beta1 clients see conditions via v1beta2→v1beta1 conversion
- Skips write when conditions are unchanged to avoid unnecessary
resourceVersion bumps on stable objects
3. Condition ownership fixes:
- Remove AgentPoolsReadyCondition from ManagedControlPlane summary:
it was never set on ManagedControlPlane (only on ManagedMachinePool).
The old v1beta1 SetSummary silently skipped it, but v1beta2
SetSummaryCondition correctly reports missing conditions as Unknown.
- Add AgentPoolsReadyCondition to ManagedMachinePool owned conditions:
it IS set on this object by the agentpools service but was missing
from WithOwnedConditions, meaning the patch helper would not include
it in server-side apply patches.
This is simpler than CAPD's pattern of individual MarkTrue/MarkFalse
at every code path — we convert all conditions in one shot at
PatchObject time.
Signed-off-by: William Yao <william2000yao@gmail.com>
- Add WithStatusSubresource to fake client builders (required for CAPI patch helper's Status().Patch() calls) - Update TestConditions to expect Ready summary condition - Fix type references from v1beta1 to v1beta2 in test code
…bhooks Move AzureMachinePool and AzureMachinePoolMachine webhook registration to internal/webhooks using v1beta2 types. This aligns them with all other CAPZ webhooks and changes webhook paths from v1beta1 to v1beta2. With matchPolicy: Equivalent, the API server converts v1beta1 requests to v1beta2 before sending to the webhook, so v1beta1 clients work transparently.
Fuzz-based roundtrip tests for all v1beta1↔v1beta2 conversions using CAPI's utilconversion.FuzzTestFunc. Verify data survives spoke→hub→spoke and hub→spoke→hub without corruption. Custom fuzzers handle intentionally lossy fields: - status.conditions: cleared on hub (no-op CAPI converters) - FailureDomains: sorted after roundtrip (map→slice→map reorders) - Initialization/Deprecated: derived from spoke fields 19 roundtrip tests: 17 api/v1beta1 + 2 exp/api/v1beta1. Signed-off-by: William Yao <william2000yao@gmail.com>
Run make generate to update all generated files: - GoMock files in azure/services/*/mock_*/ - CRD base manifests - Webhook manifests (all paths now v1beta2) - RBAC manifests Signed-off-by: William Yao <william2000yao@gmail.com>
1. ASO isOwnedBy: Compare Group+Kind+Name only, ignoring API version. After v1beta1→v1beta2 upgrade, ASO resources retain v1beta1 owner refs but controller resolves v1beta2, causing IsManaged to return false and falling back to slow per-resource deletion instead of whole RG delete. 2. BYO node pool test: CAPI MachinePool controller (v1.13.0-rc.0) only sets conditions in deprecated.v1beta1 path, not v1beta2 conditions. Use deprecatedv1beta1conditions.IsTrue(ReadyV1Beta1Condition) to read from the correct path.
97bf4b7 to
3a17370
Compare
|
/retest-required |
|
/test pull-cluster-api-provider-azure-conformance-custom-builds |
|
/retest |
fe78b53 to
e744d85
Compare
e744d85 to
3a17370
Compare
|
/retest |
1 similar comment
|
/retest |
|
@willie-yao: 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. |
|
PR needs rebase. 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. |
What type of PR is this?
/kind api-change
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
TODOs:
Release note: