@@ -117,6 +117,18 @@ const (
117117 // MachineSkipRemediationAnnotation is the annotation used to mark the machines that should not be considered for remediation by MachineHealthCheck reconciler.
118118 MachineSkipRemediationAnnotation = "cluster.x-k8s.io/skip-remediation"
119119
120+ // MachineSetSkipPreflightChecksAnnotation is the annotation used to provide a comma-separated list of
121+ // preflight checks that should be skipped during the MachineSet reconciliation.
122+ // Supported items are:
123+ // - KubeadmVersion (skips the kubeadm version skew preflight check)
124+ // - KubernetesVersion (skips the kubernetes version skew preflight check)
125+ // - ControlPlaneStable (skips checking that the control plane is neither provisioning nor upgrading)
126+ // - All (skips all preflight checks)
127+ // Example: "machineset.cluster.x-k8s.io/skip-preflight-checks": "ControlPlaneStable,KubernetesVersion".
128+ // Note: The annotation can also be set on a MachineDeployment as MachineDeployment annotations are synced to
129+ // the MachineSet.
130+ MachineSetSkipPreflightChecksAnnotation = "machineset.cluster.x-k8s.io/skip-preflight-checks"
131+
120132 // ClusterSecretType defines the type of secret created by core components.
121133 // Note: This is used by core CAPI, CAPBK, and KCP to determine whether a secret is created by the controllers
122134 // themselves or supplied by the user (e.g. bring your own certificates).
@@ -173,6 +185,38 @@ const (
173185 VariableDefinitionFromInline = "inline"
174186)
175187
188+ // MachineSetPreflightCheck defines a valid MachineSet preflight check.
189+ type MachineSetPreflightCheck string
190+
191+ const (
192+ // MachineSetPreflightCheckAll can be used to represent all the MachineSet preflight checks.
193+ MachineSetPreflightCheckAll MachineSetPreflightCheck = "All"
194+
195+ // MachineSetPreflightCheckKubeadmVersionSkew is the name of the preflight check
196+ // that verifies if the machine being created or remediated for the MachineSet conforms to the kubeadm version
197+ // skew policy that requires the machine to be at the same version as the control plane.
198+ // Note: This is a stopgap while the root cause of the problem is fixed in kubeadm; this check will become
199+ // a no-op when this check will be available in kubeadm, and then eventually be dropped when all the
200+ // supported Kuberenetes/kubeadm versions have implemented the fix.
201+ // The preflight check is only run if a ControlPlane is used (controlPlaneRef must exist in the Cluster),
202+ // the ControlPlane has a version, the MachineSet has a version and the MachineSet uses the Kubeadm bootstrap
203+ // provider.
204+ MachineSetPreflightCheckKubeadmVersionSkew MachineSetPreflightCheck = "KubeadmVersionSkew"
205+
206+ // MachineSetPreflightCheckKubernetesVersionSkew is the name of the preflight check that verifies
207+ // if the machines being created or remediated for the MachineSet conform to the Kubernetes version skew policy
208+ // that requires the machines to be at a version that is not more than 2 minor lower than the ControlPlane version.
209+ // The preflight check is only run if a ControlPlane is used (controlPlaneRef must exist in the Cluster),
210+ // the ControlPlane has a version and the MachineSet has a version.
211+ MachineSetPreflightCheckKubernetesVersionSkew MachineSetPreflightCheck = "KubernetesVersionSkew"
212+
213+ // MachineSetPreflightCheckControlPlaneIsStable is the name of the preflight check
214+ // that verifies if the control plane is not provisioning and not upgrading.
215+ // The preflight check is only run if a ControlPlane is used (controlPlaneRef must exist in the Cluster)
216+ // and the ControlPlane has a version.
217+ MachineSetPreflightCheckControlPlaneIsStable MachineSetPreflightCheck = "ControlPlaneIsStable"
218+ )
219+
176220// NodeUninitializedTaint can be added to Nodes at creation by the bootstrap provider, e.g. the
177221// KubeadmBootstrap provider will add the taint.
178222// This taint is used to prevent workloads to be scheduled on Nodes before the node is initialized by Cluster API.
0 commit comments