Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Add support for compatible contracts to clusterctl #12018

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
As documented in "Improving status in CAPI resources" proposal, for the first time CAPI will not force providers to upgrade to the new API contract (v1beta2) immediately.

Instead, we are going to consider providers implementing v1beta1 contract as compatible with v1beta2 and support them until v1beta1 API will be supported (tentatively Aug 26).

This PR makes this possible by introducing in clusterctl this idea of compatible contracts: v1beta1 will be considered compatible with v1beta2.

Note: we need to merge this PR before introducing the new contract/API version, so we can use CAPD - which will not be migrated to v1beta2 immediately - to properly test the compatibility mode

Which issue(s) this PR fixes:
Part of #11947

/area clusterctl

@k8s-ci-robot k8s-ci-robot added area/clusterctl Issues or PRs related to clusterctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 24, 2025
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 24, 2025
Comment on lines 42 to 48
GetCompatibleContractVersions = func(contract string) sets.Set[string] {
compatibleContracts := sets.New(contract)
if contract == "v1beta2" {
compatibleContracts.Insert("v1beta1")
}
return compatibleContracts
}
Copy link
Member Author

@fabriziopandini fabriziopandini Mar 24, 2025

Choose a reason for hiding this comment

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

This is the only function that we should change in future to drop compatibility with the v1beta1 contract.

Note: Test functions are not using "official" CurrentContractVersion and GetCompatibleContractVersions but instead they are injecting a copy of those values so we can keep testing support for compatible contracts also in case there are no compatible contracts for a given CAPI version.
e.g. See variables at the beginning of cmd/clusterctl/client/cluster/installer_test.go

@chrischdi
Copy link
Member

/test help

@k8s-ci-robot
Copy link
Contributor

@chrischdi: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test pull-cluster-api-build-main
/test pull-cluster-api-e2e-blocking-main
/test pull-cluster-api-e2e-conformance-ci-latest-main
/test pull-cluster-api-e2e-conformance-main
/test pull-cluster-api-e2e-latestk8s-main
/test pull-cluster-api-e2e-main
/test pull-cluster-api-e2e-mink8s-main
/test pull-cluster-api-e2e-upgrade-1-32-1-33-main
/test pull-cluster-api-test-main
/test pull-cluster-api-test-mink8s-main
/test pull-cluster-api-verify-main

The following commands are available to trigger optional jobs:

/test pull-cluster-api-apidiff-main

Use /test all to run the following jobs that were automatically triggered:

pull-cluster-api-apidiff-main
pull-cluster-api-build-main
pull-cluster-api-e2e-blocking-main
pull-cluster-api-test-main
pull-cluster-api-verify-main

In response to this:

/test help

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.

@chrischdi
Copy link
Member

/test pull-cluster-api-e2e-main

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Overall looks good

@fabriziopandini fabriziopandini added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Mar 25, 2025
@sbueringer
Copy link
Member

sbueringer commented Mar 26, 2025

All good from my side. Thx for the changes, especially the clarifications in the doc

@fabriziopandini The linter and test failures only exist after the GitHub action / Prow merged your PR into main. So basically you have to rebase this PR onto main and then you can fix the findings.

@fabriziopandini fabriziopandini force-pushed the clusterctl-compatible-contracts branch from fc8f658 to de33c61 Compare March 26, 2025 10:01
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Mar 26, 2025

@fabriziopandini: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-apidiff-main de33c61 link false /test pull-cluster-api-apidiff-main

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.

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. I understand the commands that are listed here.

@sbueringer
Copy link
Member

Thx!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 26, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 353e0b35e38b3dfeac477595d4b981d421f61657

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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:

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 26, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4704d83 into kubernetes-sigs:main Mar 26, 2025
18 of 19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.11 milestone Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/clusterctl Issues or PRs related to clusterctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants