@@ -19,7 +19,7 @@ package v1alpha1
1919import (
2020 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
22- clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1 "
22+ clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2 "
2323 runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog"
2424)
2525
@@ -31,11 +31,11 @@ type GenerateUpgradePlanRequest struct {
3131 // CommonRequest contains fields common to all request types.
3232 CommonRequest `json:",inline"`
3333
34- // cluster is the cluster ofject the lifecycle hook correspods to.
34+ // cluster is the cluster object the GenerateUpgradePlan request corresponds to.
3535 // +required
36- Cluster clusterv1beta1 .Cluster `json:"cluster,omitempty,omitzero"`
36+ Cluster clusterv1 .Cluster `json:"cluster,omitempty,omitzero"`
3737
38- // fromControlPlaneKubernetesVersion is the current Kubernetes version of the control plane .
38+ // fromControlPlaneKubernetesVersion is the min current Kubernetes version of the workers (MachineDeployments and MachinePools) .
3939 // +required
4040 // +kubebuilder:validation:MinLength=1
4141 FromControlPlaneKubernetesVersion string `json:"fromControlPlaneKubernetesVersion,omitempty"`
@@ -63,18 +63,35 @@ type GenerateUpgradePlanResponse struct {
6363
6464 // controlPlaneUpgrades is the list of version upgrade steps for the control plane.
6565 // Each entry represents an intermediate version that must be applied in sequence.
66+ // The following rules apply:
67+ // - there should be at least one version for every minor between fromControlPlaneKubernetesVersion (excluded) and ToKubernetesVersion (included).
68+ // - each version must be:
69+ // - greater than fromControlPlaneKubernetesVersion (or with a different build number)
70+ // - greater than the previous version in the list (or with a different build number)
71+ // - less or equal to ToKubernetesVersion (or with a different build number)
72+ // - the last version in the plan must be equal to ToKubernetesVersion
6673 // +optional
67- // +listType=atomic
68- // +kubebuilder:validation:MinItems=1
69- // +kubebuilder:validation:MaxItems=1000
7074 ControlPlaneUpgrades []UpgradeStep `json:"controlPlaneUpgrades,omitempty"`
7175
7276 // workersUpgrades is the list of version upgrade steps for the workers.
7377 // Each entry represents an intermediate version that must be applied in sequence.
78+ //
79+ // In case the upgrade plan for workers will be left to empty, the system will automatically
80+ // determine the minimal number of workers upgrade steps, thus minimizing impact on workloads and reducing
81+ // the overall upgrade time.
82+ //
83+ // If instead for any reason a custom upgrade path for workers is required, the following rules apply:
84+ // - each version must be:
85+ // - equal to FromControlPlaneKubernetesVersion or to one of the versions in the control plane upgrade plan.
86+ // - greater than FromWorkersKubernetesVersion (or with a different build number)
87+ // - greater than the previous version in the list (or with a different build number)
88+ // - less or equal to the ToKubernetesVersion (or with a different build number)
89+ // - in case of versions with the same major/minor/patch version but different build number, also the order
90+ // of those versions must be the same for control plane and worker upgrade plan.
91+ // - the last version in the plan must be equal to ToKubernetesVersion
92+ // - the upgrade plane must have all the intermediate version which workers must go through to avoid breaking rules
93+ // defining the max version skew between control plane and workers.
7494 // +optional
75- // +listType=atomic
76- // +kubebuilder:validation:MinItems=1
77- // +kubebuilder:validation:MaxItems=1000
7895 WorkersUpgrades []UpgradeStep `json:"workersUpgrades,omitempty"`
7996}
8097
@@ -105,6 +122,8 @@ func init() {
105122 "\n " +
106123 "Notes:\n " +
107124 "- The response may include separate upgrade paths for control plane and workers\n " +
125+ "- The upgrade plan for workers is optional; if missing the system will automatically\n \" " +
126+ " determine the minimal number of workers upgrade steps according to Kubernetes version skew rules.\n " +
108127 "- Each upgrade step represents a version that must be applied in sequence" ,
109128 })
110129}
0 commit comments