Skip to content

Commit 47503f5

Browse files
📖 Small improvements to migration instructions (#12328)
* Small improvements to migration instructions * More improvements * Address comments * Address more feedback
1 parent 2a5ee95 commit 47503f5

File tree

1 file changed

+58
-15
lines changed

1 file changed

+58
-15
lines changed

docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ proposal because most of the changes described below are a consequence of the wo
4444
* [Stage 1](#stage-1-)
4545
* [Stage 2](#stage-2)
4646
* [Stage 3](#stage-3)
47+
* [Annex](#annex)
48+
* [Imports for conditions and patch helper utils](#imports-for-conditions-and-patch-helper-utils)
4749
<!-- TOC -->
4850

4951
## Go version
@@ -510,7 +512,14 @@ As documented in [Suggested changes for providers](#suggested-changes-for-provid
510512
Please refer to [API Changes](#api-changes) for more details about the changes introduced by this release.
511513

512514
Note: it is technically possible for providers to keep using v1beta1 types from CAPI v1.11, but this is
513-
not recommended (this approach was not tested during the implementation, we don't know if there are road blockers).
515+
not recommended because it will lead to additional conversion calls.
516+
517+
Additionally, in v1.11 all the CAPI utils like e.g. `IsControlPlaneMachine` are now using v1beta2 API types.
518+
This might lead to additional work for providers to keep using v1beta1 types from CAPI v1.11 (you have to fork
519+
all utils the provider is using from an older CAPI release or replace them with something else).
520+
521+
Last but not least, please be aware that given the issues above, this approach was not tested during the implementation,
522+
and we don't know if there are road blockers.
514523

515524
- If providers are using Conditions from Cluster API resources, e.g. by looking at the ControlPlaneInitialized condition
516525
on the Cluster object, we highly recommend providers to use new conditions instead of old ones.
@@ -618,20 +627,24 @@ into:
618627
```go
619628
import (
620629
...
621-
conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"
622-
patch "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"
630+
v1beta1conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"
631+
v1beta1patch "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"
623632
)
624633
```
625634

635+
Important!
636+
Please pay special attention to use `sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch` import everywhere,
637+
because using `sigs.k8s.io/cluster-api/util/patch` by mistake could in some cases lead to dropping conditions at runtime.
638+
626639
Also, please note that starting from the CAPI release when v1beta1 removal will happen (tentative Aug 2026), the Cluster API project
627640
will remove the Cluster API condition type, the `util/conditions/deprecated/v1beta1` package, the `util/deprecated/v1beta1` package,
628641
the code handling old conditions in `util/patch.Helper` and everything related to the custom Cluster API custom condition type.
629642

630643
This means that if a provider wants to keep using deprecated v1beta1 conditions after this date, they have to maintain their
631644
own custom copy of the types and related utils.
632645

633-
Please also note that the v1beta2 contract is not going to require a specific condition types, so it will be also possible
634-
to use different custom conditions types,
646+
Also note that the v1beta2 contract is not going to require a specific condition type, so it will be also possible
647+
to use a custom condition type,
635648

636649
See [Suggested changes for providers](#suggested-changes-for-providers) and [Cluster API Contract changes](#cluster-api-contract-changes)
637650
for more details.
@@ -652,19 +665,22 @@ If you are at this stage, you must use following util packages from CAPI v1.11 (
652665
```go
653666
import (
654667
...
655-
conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"
668+
v1beta1conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"
656669
v1beta2conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions/v1beta2"
657-
patch "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"
670+
v1beta1patch "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"
658671
)
659672
```
660673

661-
- the `conditions` package alias provides access to utils for managing `clusterv1beta1.Conditions` in `status.conditions`
674+
- the `v1beta1conditions` package alias provides access to utils for managing `clusterv1beta1.Conditions` in `status.conditions`
662675
- the `v1beta2conditions` package alias provides access to utils for managing `metav1.Conditions` in `status.v1beta2.conditions`
663-
- the `patch` package alias provides access to utils for patching objects in this phase.
676+
- the `v1beta1patch` package alias provides access to utils for patching objects in this phase.
664677

665678
Important!
666-
All packages from the import above (all packages below `sigs.k8s.io/cluster-api/util/deprecated/v1beta1`) are going
667-
to be removed from CAPI when the v1beta1 removal will happen (tentative Aug 2026).
679+
- Please pay special attention to use `sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch` import everywhere,
680+
because using `sigs.k8s.io/cluster-api/util/patch` by mistake could in some cases lead to dropping conditions at runtime
681+
(note: `sigs.k8s.io/cluster-api/util/patch` is the package we assume you are using before stage 1).
682+
- All packages from the import above (all packages below `sigs.k8s.io/cluster-api/util/deprecated/v1beta1`) are going
683+
to be removed from CAPI when the v1beta1 removal will happen (tentative Aug 2026).
668684

669685
#### Stage 2
670686

@@ -678,18 +694,21 @@ If you are at this stage, you must use following util packages from CAPI v1.11 (
678694
import (
679695
...
680696
"sigs.k8s.io/cluster-api/util/conditions"
681-
v1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1"
697+
deprecatedv1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1"
682698
"sigs.k8s.io/cluster-api/util/patch"
683699
)
684700
```
685701

686702
- the `conditions` package provides access to utils for managing `metav1.Conditions` in `status.conditions`
687-
- the `v1beta1conditions` package alias provides access to utils for managing `clusterv1beta2.Conditions` in `status.deprecated.v1beta1.conditions`
703+
- the `deprecatedv1beta1conditions` package alias provides access to utils for managing `clusterv1.Conditions` in `status.deprecated.v1beta1.conditions`
688704
- the `patch` package provides access to utils for patching objects in this phase
689705

690706
Important!
691-
The package `sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1`" is going to be removed from CAPI when the
692-
v1beta1 removal will happen (tentative Aug 2026).
707+
- Please pay special attention to use `sigs.k8s.io/cluster-api/util/patch` import everywhere,
708+
because using `sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch` by mistake could in some cases lead to dropping conditions at runtime
709+
(note: `sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch` is the package you were using in stage 1, it should not be used in stage 2).
710+
- The package `sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1`" is going to be removed from CAPI when the
711+
v1beta1 removal will happen (tentative Aug 2026).
693712

694713
#### Stage 3
695714

@@ -707,3 +726,27 @@ import (
707726

708727
- the `conditions` package provides access to utils for managing `metav1.Conditions` in `status.conditions`
709728
- the `patch` package provides access to utils for patching objects in this phase
729+
730+
Important!
731+
- Please pay special attention to use `sigs.k8s.io/cluster-api/util/patch` import everywhere,
732+
because using `sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch` by mistake could in some cases lead to dropping conditions at runtime
733+
(note: `sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch` is the package in stage 1, if should not be used in following stages).
734+
735+
## Annex
736+
737+
### Imports for conditions and patch helper utils
738+
739+
In order to help users to transition away from the CAPI conditions type, CAPI v1.11 supports
740+
different versions of conditions and patch helper utils.
741+
742+
Following table should help to pick the right utils.
743+
744+
| Field to change | Import for condition util | Import for patch helper |
745+
|-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
746+
| `status.conditions` of type `clusterv1beta1.Conditions` | `v1beta1conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"` | `v1beta1patch "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"` |
747+
| `status.v1beta2.conditions` of type `[]metav1.Conditions` | `v1beta2conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions/v1beta2"` | `v1beta1patch "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"` |
748+
| `status.deprecated.v1beta1.conditions` of type `clusterv1.Conditions` | `deprecatedv1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1"` | `"sigs.k8s.io/cluster-api/util/patch"` |
749+
| `status.conditions` of type `[]metav1.Conditions` | `"sigs.k8s.io/cluster-api/util/conditions"` | `"sigs.k8s.io/cluster-api/util/patch"` |
750+
Important!
751+
- Please pay special attention to use the correct patch helper import everywhere, because using a wrong
752+
one could in some cases lead to dropping conditions at runtime while not having compile errors.

0 commit comments

Comments
 (0)