enable multiple control plane classes#1
Draft
Dhairya-Arora01 wants to merge 35 commits intosyself-1.10.7from
Draft
enable multiple control plane classes#1Dhairya-Arora01 wants to merge 35 commits intosyself-1.10.7from
Dhairya-Arora01 wants to merge 35 commits intosyself-1.10.7from
Conversation
- ClusterClass now supports multiple classes for control-plane - similar to workers. - Cluster topology now includes a field "class" for control-plane which references to the control. Signed-off-by: Dhairya Arora <dhairya.arora@syself.com>
batistein
requested changes
Feb 25, 2026
| // ClusterClass.spec.controlPlane.classes. | ||
| // Otherwise, the inline ClusterClass.spec.controlPlane is used. | ||
| func resolveControlPlaneClass(cluster *clusterv1.Cluster, clusterClass *clusterv1.ClusterClass) (*clusterv1.ControlPlaneClass, error) { | ||
| // If the topology doesn't specify a class, use the inline definition. |
There was a problem hiding this comment.
How can we specify a default? We need to ensure that every cluster using a newer clusterclass/clusterstack is using a default without the need to specify in the cluster object
|
@Dhairya-Arora01 please add |
In order to fix the error on applying the updated CRDs ``` failed to patch provider object: CustomResourceDefinition.apiextensions.k8s.io \"clusterclasses.cluster.x-k8s.io\" is invalid: spec.versions[1].schema.openAPIV3Schema.properties[spec].properties[controlPlaneClasses].items.properties[class].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property ``` Signed-off-by: Dhairya Arora <dhairya.arora@syself.com>
Signed-off-by: Dhairya Arora <dhairya.arora@syself.com>
…ed for control-plane
…e changed for control-plane
janiskemper
reviewed
Feb 27, 2026
| "currentKind", s.Current.ControlPlane.InfrastructureMachineTemplate.GetKind(), | ||
| "desiredKind", s.Desired.ControlPlane.InfrastructureMachineTemplate.GetKind(), | ||
| ) | ||
| currentCPInfraMachineTemplate = nil |
There was a problem hiding this comment.
can you add a comment to explain why you set it on nil? This is not clear to me
…ed to be changed for control-plane
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
CAPI's
ClusterClasscurrently supports only a single control plane definition under spec.controlPlane. This means all clusters using a ClusterClass are locked to one type of machine infrastructure for the control planeWith Hetzner disabling certain locations for HCloud machines for some customers, we need the ability to spin up baremetal based cp as an alternative, but the current design doesn't allow this.
When we tried to set the
spec.controlPlane.machineInfrastructure.reftoHetznerBareMetalMachineTemplate, the ClusterClass was rejected by the admission webhook:This happened because existing patches for HCloud machines use
controlPlane: trueselectors withkind: HCloudMachineTemplate. When we changedspec.controlPlaneto referenceHetznerBareMetalMachineTemplateinstead, those HCloud patches no longer matched any ref inspec.controlPlane, causing validation to fail.Solution
This PR introduces multiple control plane classes in the same way as how workers already support multiple
MachineDeploymentClassentries. This allows different machine infrastructure types to exist with each targeted by its own patches.Key changes:
ClusterClass now supports multiple classes for control-plane - similar to workers.
Cluster topology now includes a field "class" for control-plane which references to the control. If
classis empty, it would mean that we fallback to the old way i.e.clusterclass.spec.controlPlanewill be used.clusterclass.spec.controlPlane(old way) stays populated with HCloud refclusterclass.spec.controlPlaneClasses(new list) is populated with both hcloud and baremetal as classes.Patches that apply to old way keep using
controlPlane: true.Patches that are infras specific use
controlPlaneClass.names.Example of clusterclass
Example of Patches:
For infra specific patch (i.e. patch in our classes)
For Clusters now
if we dont set the
topology.controlPlane.classfield then it will use hcloud by deffaultotherwise specify the class from the clusterclass cp classes.
also matchLabels required to select a particular hbmh
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #