Skip to content

chore: upgrade cluster-api to v1.12.4#356

Open
schegi wants to merge 44 commits intomainfrom
feat/upgrade-cluster-api-v1.12.4
Open

chore: upgrade cluster-api to v1.12.4#356
schegi wants to merge 44 commits intomainfrom
feat/upgrade-cluster-api-v1.12.4

Conversation

@schegi
Copy link
Copy Markdown
Contributor

@schegi schegi commented Apr 3, 2026

Summary

  • Bump sigs.k8s.io/cluster-api and cluster-api/test v1.11.7 → v1.12.4
  • Bump sigs.k8s.io/controller-runtime v0.21.0 → v0.22.5 and k8s.io/* v0.33.3 → v0.34.3
  • Update e2e clusterctl config: component URLs → v1.12.4
  • Add test/e2e/data/shared/v1.12/metadata.yaml for clusterctl compatibility
  • Configure wait-control-plane-upgrade and wait-machine-deployment-upgrade e2e timeouts per CAPI v1.12 migration guide

No code changes required — the provider already uses clusterv1.APIEndpoint directly (not a copied struct), has no MachinePool implementation, does not use the changed utility functions (IsOwnedByObject, IsControlledBy, OwnedMachines), and completed v1beta2 migration in the v1.11 upgrade.

Test Plan

  • make build passes
  • make lint passes
  • make unit-test passes (with -race and -shuffle)
  • make integration-test passes (90/90 specs)

Merge

4 PRs in total (merge in that order, maybe release inbetween):

  1. v1.8 → v1.9 feat: upgrade cluster-api to v1.9.11 with v1beta2 conditions #352
  2. v1.9 → v1.10 feat: upgrade cluster-api to v1.10.10 #353
  3. v1.10 → v1.11 chore: upgrade cluster-api to v1.11.7 #354
  4. v1.11 → v1.12 this PR

schegi and others added 30 commits April 1, 2026 17:21
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ated FailureReason/FailureMessage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace v1beta1 conditions import with v1beta2 alias and update PatchObject
to use SetSummaryCondition and WithOwnedV1Beta2Conditions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ions to v1beta2

Update IonosCloudClusterReconciler to use the new predicate signatures
(scheme + logger) and replace conditions.MarkTrue with conditions.Set
using metav1.Condition for compatibility with cluster-api v1beta2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…HasFailed guard

Replace conditions import with v1beta2 alias, remove the dead HasFailed guard
(method removed in Task 7), and replace MarkFalse calls with conditions.Set
using metav1.Condition structs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Regenerate mocks after interface updates (import ordering change)
- Fix ionoscloudmachine_types_test.go: remove FailureReason/FailureMessage
  references removed from IonosCloudMachineStatus in v1.9 upgrade
- Update .golangci.yml: extend comment-spacings exclusion to allow
  //+listType and //+listMapKey controller-gen markers
- Apply gofmt/gci formatting fixes (blank line removal in machine_test.go)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…runtime v0.20 upgrade

Replace removed GetVariable with MustGetVariable on clusterctl.E2EConfig (renamed in CAPI v1.10).
Fix import ordering in e2e ownerreference helper. Regenerate CRD manifests with updated field
descriptions and validation constraints from the new controller-gen output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auto-fixed by golangci-lint --fix (gci + gofumpt) to align with
strict formatting rules enforced by the linter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…contract

Rename the four condition methods on IonosCloudCluster and IonosCloudMachine
to match the v1.11 interface expectations:
- GetConditions() clusterv1.Conditions → GetV1Beta1Conditions()
- SetConditions(clusterv1.Conditions) → SetV1Beta1Conditions()
- GetV1Beta2Conditions() []metav1.Condition → GetConditions()
- SetV1Beta2Conditions([]metav1.Condition) → SetConditions()

Update test callers accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…→ WithOwnedV1Beta1Conditions)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s to v0.33.3

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… API types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Switch clusterv1 import from api/core/v1beta1 to api/core/v1beta2 in all
non-API files. This is required because CAPI v1.11 utility functions
(GetOwnerCluster, IsControlPlaneMachine, etc.) now return/accept v1beta2
types. Adapt InfrastructureReady check to use the v1beta2
Initialization.InfrastructureProvisioned field, replace
util.IsControlPlaneMachine with a local helper using v1beta1 label
constant, and convert APIEndpoint between v1beta1 and v1beta2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
schegi and others added 14 commits April 2, 2026 01:41
Switch API type files from api/core/v1beta1 to api/core/v1beta2 so the
deprecated conditions interface (GetV1Beta1Conditions/SetV1Beta1Conditions)
matches the v1beta2 type signatures expected by CAPI v1.11. Fix test files
for v1beta2 field changes (Version, ProviderID now string instead of *string).
Regenerate deepcopy and CRD manifests. Bump mockery to v2.53.6 with
GOTOOLCHAIN=go1.25.0 for Go 1.25 compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…eta2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restructure API status types to match CAPI v1.11 Stage 2 condition layout:
- Move v1beta2 conditions (metav1.Condition) to top-level status.conditions
- Demote v1beta1 conditions to status.deprecated.v1beta1.conditions
- Add status.initialization.provisioned for v1beta2 contract readiness
- Move deprecated status.ready to status.deprecated.v1beta1.ready
- Add +kubebuilder:validation:MaxItems=32 on conditions slices
- Fix .golangci.yml importas rules for new CAPI v1.11 package paths
- Update e2e config to v1.11.0 version names with v1.11 metadata

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adapt ValidateResourceVersionStable call to new struct-based API and
run go mod tidy to promote k8s.io/apiextensions-apiserver to direct dep.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ated field warnings

Replace deprecated CAPI v1beta1 package imports (addons, bootstrap/kubeadm,
controlplane/kubeadm, ipam) with v1beta2 equivalents. Add nolint:staticcheck
for intentional deprecated field usage (v1beta1 backwards compatibility).
Adapt IPAddressClaim creation for v1beta2 IPPoolReference type change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove redundant "conditions" import aliases (revive)
- Extract setupCRDMigrator to reduce main() function length (revive)
- Remove unnecessary ConditionType conversion (unconvert)
- Remove unused nolint:staticcheck directives (nolintlint)
- Fix GCI import ordering and gofumpt alignment

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Restore required conditions import alias (importas config)
- Disable redundant-import-alias revive rule (conflicts with importas)
- Fix deep-exit: return error from setupCRDMigrator instead of os.Exit
- Update importas config for ipam v1beta2 package path

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without the cluster.x-k8s.io/v1beta2 label on CRDs, CAPI falls back to
the v1beta1 contract and reads status.ready at the top level, which is
never set (the field lives at status.deprecated.v1beta1.ready). This
caused the e2e MachineDeploymentScaleSpec to time out waiting for
Cluster status.infrastructureReady to become true.

Adding the v1beta2 label makes CAPI use the v1beta2 contract path,
which reads status.initialization.provisioned — a field the controllers
already set correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ility

The metadata.yaml contract field is used by clusterctl for provider
compatibility checks. Setting it to v1beta2 caused clusterctl init to
reject the provider since the CAPI core metadata declares v1beta1.

The runtime v1beta2 contract behavior is correctly driven by the CRD
label (cluster.x-k8s.io/v1beta2) added in the previous commit, not
by the metadata contract field.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s to v0.34.3

Update e2e clusterctl config component URLs to v1.12.4, add v1.12
metadata file, and configure wait-control-plane-upgrade and
wait-machine-deployment-upgrade timeouts per CAPI v1.12 migration guide.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 3, 2026 08:47
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 3, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Upgrades this provider to Cluster API v1.12.4 (and matching controller-runtime / Kubernetes libraries), updating the provider’s API surface and e2e harness to the v1beta2 contract and related migration requirements.

Changes:

  • Bump sigs.k8s.io/cluster-api (+ test framework), controller-runtime, and k8s.io/* dependencies to the v1.12 / v0.22 / v0.34 series.
  • Migrate imports and status/conditions handling to the CAPI v1beta2 APIs (including new status.initialization.* and metav1 conditions), and wire up the CAPI CRDMigrator.
  • Update e2e clusterctl config/metadata and timeouts to align with CAPI v1.12 expectations.

Reviewed changes

Copilot reviewed 43 out of 44 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/e2e/suite_test.go Updates CAPI/IPAM imports and e2e config variable access for new framework APIs.
test/e2e/helpers/ownerreference.go Switches helper imports to v1beta2 CAPI API packages.
test/e2e/helpers/finalizers.go Updates addons API import to v1beta2 path.
test/e2e/data/shared/v1.9/metadata.yaml Adds clusterctl metadata for v1.9 release series.
test/e2e/data/shared/v1.10/metadata.yaml Adds/updates clusterctl metadata for v1.10 release series.
test/e2e/data/shared/v1.11/metadata.yaml Adds/updates clusterctl metadata for v1.11 release series.
test/e2e/data/shared/v1.12/metadata.yaml Adds clusterctl metadata for v1.12 release series.
test/e2e/config/ionoscloud.yaml Updates CAPI component URLs and adds new upgrade wait intervals.
test/e2e/capic_test.go Adapts to updated ValidateResourceVersionStable input struct API.
scope/machine.go Migrates patching/conditions summarization to v1beta2 + owned v1beta1/v1beta2 conditions.
scope/machine_test.go Removes tests for removed failure fields/HasFailed and updates CAPI import.
scope/cluster.go Migrates patching/conditions summarization to v1beta2 + owned v1beta1/v1beta2 conditions.
scope/cluster_test.go Updates CAPI import to v1beta2.
Makefile Updates mockery version and pins toolchain env for mockery execution.
internal/service/k8s/ipam.go Updates CAPI/IPAM imports and adapts to new PoolRef type (IPPoolReference).
internal/service/k8s/ipam_test.go Updates tests to match new CAPI/IPAM types (string fields, pointer prefix, pool ref conversion).
internal/service/cloud/suite_test.go Updates CAPI/IPAM imports and adapts to MachineSpec field type changes.
internal/service/cloud/server.go Updates machine provisioning status/conditions for v1beta2 initialization + deprecated v1beta1 ready.
internal/service/cloud/network.go Updates CAPI import and replaces util.IsControlPlaneMachine with local label check.
internal/service/cloud/network_test.go Updates CAPI import to v1beta2.
internal/service/cloud/ipblock.go Updates CAPI import to v1beta2.
internal/service/cloud/ipblock_test.go Updates CAPI import to v1beta2.
internal/service/cloud/image.go Adapts to MachineSpec Version becoming a string.
internal/service/cloud/image_test.go Updates tests for MachineSpec Version string semantics.
internal/ionoscloud/clienttest/mock_client.go Regenerates mock header for newer mockery version.
internal/controller/ionoscloudmachine_controller.go Migrates controller to v1beta2 CAPI APIs and updates condition setting.
internal/controller/ionoscloudcluster_controller.go Migrates controller to v1beta2 CAPI APIs, sets initialization + deprecated ready, updates predicates API.
config/rbac/role.yaml Adds RBAC for CRDMigrator and template CR access.
config/crd/kustomization.yaml Adds v1beta2 contract label for CRDs.
config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachinetemplates.yaml Regenerated CRD schema updates (metadata constraints/text changes).
config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachines.yaml Regenerated CRD schema updates: initialization/deprecated fields, metav1 conditions schema, printcolumn JSONPath changes.
config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclustertemplates.yaml Regenerated CRD schema updates for APIEndpoint validation/constraints.
config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclusters.yaml Regenerated CRD schema updates: initialization/deprecated fields, metav1 conditions schema, printcolumn JSONPath changes.
cmd/main.go Registers apiextensions scheme, adds CRDMigrator controller setup + flag and RBAC markers.
api/v1alpha1/zz_generated.deepcopy.go Regenerates deepcopy for new status structs and metav1 conditions.
api/v1alpha1/suite_test.go Updates IPAM API import to v1beta2.
api/v1alpha1/ionoscloudmachinetemplate_types.go Updates CAPI import to v1beta2 core API.
api/v1alpha1/ionoscloudmachine_types.go Migrates machine status to v1beta2 conditions + initialization/deprecated fields; adds v1beta1 condition accessors.
api/v1alpha1/ionoscloudmachine_types_test.go Updates tests to use deprecated v1beta1 conditions helper and new status layout.
api/v1alpha1/ionoscloudcluster_types.go Migrates cluster status to v1beta2 conditions + initialization/deprecated fields; adds v1beta1 condition accessors.
api/v1alpha1/ionoscloudcluster_types_test.go Updates tests to use deprecated v1beta1 conditions helper and new status layout.
.golangci.yml Updates import alias rules for new CAPI packages and bumps configured Go version.
go.mod Bumps module Go version and updates dependencies to CAPI v1.12.4 / controller-runtime v0.22.5 / k8s v0.34.3.
go.sum Updates checksums for upgraded dependency graph.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to 10
- name: "v1.12.0"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.12.4/core-components.yaml"
type: url
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

versions[].name is v1.12.0 but the URL points to the v1.12.4 release. Consider aligning the name with the actual component version being installed to avoid confusion in e2e/upgrade runs.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to 22
- name: "v1.12.0"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.12.4/bootstrap-components.yaml"
type: url
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

versions[].name is v1.12.0 but the URL points to the v1.12.4 release. Consider aligning the name with the actual component version being installed to avoid confusion in e2e/upgrade runs.

Copilot uses AI. Check for mistakes.
Comment on lines +32 to 34
- name: "v1.12.0"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.12.4/control-plane-components.yaml"
type: url
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

versions[].name is v1.12.0 but the URL points to the v1.12.4 release. Consider aligning the name with the actual component version being installed to avoid confusion in e2e/upgrade runs.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants