Skip to content

WIP: Add v1beta2 contract fields (initialization, conditions) to API types#6199

Draft
willie-yao wants to merge 2 commits intokubernetes-sigs:mainfrom
willie-yao:v1beta2-contract-fields
Draft

WIP: Add v1beta2 contract fields (initialization, conditions) to API types#6199
willie-yao wants to merge 2 commits intokubernetes-sigs:mainfrom
willie-yao:v1beta2-contract-fields

Conversation

@willie-yao
Copy link
Copy Markdown
Contributor

@willie-yao willie-yao commented Apr 2, 2026

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
This PR adds the v1beta2 CAPI contract fields to all CAPZ provider API types (Stage 1 of the conditions migration). This is purely additive with no behavioral changes. Controllers will dual-write these fields in a follow-up PR.

General implementation formula:

  • Types with Ready → need an Initialization struct
  • Types with Conditions → need a v1beta2 substruct + getter/setter methods
  • Types with FailureReason/FailureMessage → need deprecation comments
  • ControlPlane types → use ControlPlaneInitialized instead of Provisioned

Changes per type:

  • Add status.initialization.provisioned *bool to all InfraCluster/InfraMachine types (AzureCluster, AzureMachine, AzureManagedCluster, AzureManagedMachinePool, AzureMachinePool, AzureMachinePoolMachine, and ASO-managed types)
  • Add status.initialization.controlPlaneInitialized *bool to ControlPlane types (AzureManagedControlPlane, AzureASOManagedControlPlane)
  • Add status.v1beta2.conditions []metav1.Condition with GetV1Beta2Conditions/SetV1Beta2Conditions methods to all types that have conditions
  • Add deprecation comments to status.ready, failureReason/failureMessage, errorReason/errorMessage

These fields are not yet read by CAPI. That only happens when the CRD label is updated to declare v1beta2 contract compliance in a later PR.

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 part of #6136

Special notes for your reviewer:

Contract documentation pages

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • cherry-pick candidate

Release note:

Add v1beta2 contract fields (initialization, conditions) to API types

Signed-off-by: William Yao <william2000yao@gmail.com>
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Apr 2, 2026
@k8s-ci-robot k8s-ci-robot requested review from Jont828 and nojnhuh April 2, 2026 16:04
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mboersma for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 2, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 1.53846% with 64 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.57%. Comparing base (4c5753c) to head (f5111c0).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
api/v1beta1/azurecluster_types.go 0.00% 8 Missing ⚠️
api/v1beta1/azureclusteridentity_types.go 0.00% 8 Missing ⚠️
api/v1beta1/azuremachine_types.go 0.00% 8 Missing ⚠️
api/v1beta1/azuremanagedcontrolplane_types.go 0.00% 8 Missing ⚠️
api/v1beta1/azuremanagedmachinepool_types.go 0.00% 8 Missing ⚠️
exp/api/v1beta1/azuremachinepool_types.go 0.00% 8 Missing ⚠️
exp/api/v1beta1/azuremachinepoolmachine_types.go 0.00% 8 Missing ⚠️
azure/scope/machine.go 0.00% 2 Missing ⚠️
azure/scope/machinepool.go 0.00% 2 Missing ⚠️
azure/scope/machinepoolmachine.go 0.00% 2 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6199      +/-   ##
==========================================
- Coverage   43.67%   43.57%   -0.10%     
==========================================
  Files         289      289              
  Lines       25495    25551      +56     
==========================================
  Hits        11134    11134              
- Misses      13559    13615      +56     
  Partials      802      802              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@willie-yao
Copy link
Copy Markdown
Contributor Author

/retest

@willie-yao willie-yao force-pushed the v1beta2-contract-fields branch from 5ff0c6d to fd61436 Compare April 2, 2026 20:19
Signed-off-by: William Yao <william2000yao@gmail.com>
@willie-yao willie-yao force-pushed the v1beta2-contract-fields branch from fd61436 to f5111c0 Compare April 2, 2026 20:50
@willie-yao willie-yao changed the title WIP: Add v1beta2 contract fields (initialization, conditions) to API types Add v1beta2 contract fields (initialization, conditions) to API types Apr 6, 2026
@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 Apr 6, 2026
@willie-yao willie-yao added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Apr 6, 2026
@willie-yao willie-yao changed the title Add v1beta2 contract fields (initialization, conditions) to API types WIP: Add v1beta2 contract fields (initialization, conditions) to API types Apr 6, 2026
@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 Apr 6, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@willie-yao: Closed this PR.

Details

In response to this:

/close

Reconsider implementing new api version from the start

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-sigs/prow repository.

@github-project-automation github-project-automation bot moved this from Todo to Done in CAPZ Planning Apr 6, 2026
@k8s-ci-robot k8s-ci-robot reopened this Apr 6, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@willie-yao: Reopened this PR.

Details

In response to this:

/reopen

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-sigs/prow repository.

@github-project-automation github-project-automation bot moved this from Done to In Progress in CAPZ Planning Apr 6, 2026
@willie-yao willie-yao marked this pull request as draft April 6, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants