Skip to content

⚠️ Rename ClusterClass MachineInfrastructure #12511

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions api/core/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ func Convert_v1beta1_ControlPlaneClass_To_v1beta2_ControlPlaneClass(in *ControlP
out.Deletion.NodeVolumeDetachTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeVolumeDetachTimeout)
out.Deletion.NodeDeletionTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDeletionTimeout)
convert_v1beta1_LocalObjectTemplate_To_v1beta2_ClusterClassTemplateReference(&in.LocalObjectTemplate, &out.TemplateRef, s)
if in.MachineInfrastructure != nil && in.MachineInfrastructure.Ref != nil {
out.InfrastructureMachine = &clusterv1.ControlPlaneClassInfrastructureMachineTemplate{}
return Convert_v1beta1_LocalObjectTemplate_To_v1beta2_ControlPlaneClassInfrastructureMachineTemplate(in.MachineInfrastructure, out.InfrastructureMachine, s)
}
return nil
}

Expand All @@ -725,6 +729,10 @@ func Convert_v1beta2_ControlPlaneClass_To_v1beta1_ControlPlaneClass(in *clusterv
out.NodeVolumeDetachTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeVolumeDetachTimeoutSeconds)
out.NodeDeletionTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeDeletionTimeoutSeconds)
Convert_v1beta2_ClusterClassTemplateReference_To_v1beta1_LocalObjectTemplate(&in.TemplateRef, &out.LocalObjectTemplate, s)
if in.InfrastructureMachine != nil && !reflect.DeepEqual(in.InfrastructureMachine.TemplateRef, clusterv1.ControlPlaneClassInfrastructureMachineTemplate{}) {
out.MachineInfrastructure = &LocalObjectTemplate{}
return Convert_v1beta2_ControlPlaneClassInfrastructureMachineTemplate_To_v1beta1_LocalObjectTemplate(in.InfrastructureMachine, out.MachineInfrastructure, s)
}
return nil
}

Expand Down Expand Up @@ -1672,7 +1680,7 @@ func Convert_v1beta2_MachineNodeReference_To_v1_ObjectReference(in *clusterv1.Ma
return nil
}

func Convert_v1beta1_LocalObjectTemplate_To_v1beta2_ControlPlaneClassMachineInfrastructureTemplate(in *LocalObjectTemplate, out *clusterv1.ControlPlaneClassMachineInfrastructureTemplate, s apimachineryconversion.Scope) error {
func Convert_v1beta1_LocalObjectTemplate_To_v1beta2_ControlPlaneClassInfrastructureMachineTemplate(in *LocalObjectTemplate, out *clusterv1.ControlPlaneClassInfrastructureMachineTemplate, s apimachineryconversion.Scope) error {
convert_v1beta1_LocalObjectTemplate_To_v1beta2_ClusterClassTemplateReference(in, &out.TemplateRef, s)
return nil
}
Expand Down Expand Up @@ -1709,7 +1717,7 @@ func convert_v1beta1_LocalObjectTemplate_To_v1beta2_ClusterClassTemplateReferenc
}
}

func Convert_v1beta2_ControlPlaneClassMachineInfrastructureTemplate_To_v1beta1_LocalObjectTemplate(in *clusterv1.ControlPlaneClassMachineInfrastructureTemplate, out *LocalObjectTemplate, s apimachineryconversion.Scope) error {
func Convert_v1beta2_ControlPlaneClassInfrastructureMachineTemplate_To_v1beta1_LocalObjectTemplate(in *clusterv1.ControlPlaneClassInfrastructureMachineTemplate, out *LocalObjectTemplate, s apimachineryconversion.Scope) error {
Convert_v1beta2_ClusterClassTemplateReference_To_v1beta1_LocalObjectTemplate(&in.TemplateRef, out, s)
return nil
}
Expand Down
28 changes: 6 additions & 22 deletions api/core/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions api/core/v1beta2/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,13 @@ type ControlPlaneClass struct {
// +required
TemplateRef ClusterClassTemplateReference `json:"templateRef,omitempty,omitzero"`

// machineInfrastructure defines the metadata and infrastructure information
// for control plane machines.
// infrastructureMachine defines infrastructure for control plane machines.
//
// This field is supported if and only if the control plane provider template
// referenced above is Machine based and supports setting replicas.
//
// +optional
MachineInfrastructure *ControlPlaneClassMachineInfrastructureTemplate `json:"machineInfrastructure,omitempty"`
InfrastructureMachine *ControlPlaneClassInfrastructureMachineTemplate `json:"infrastructureMachine,omitempty"`
Copy link
Member

@sbueringer sbueringer Jul 22, 2025

Choose a reason for hiding this comment

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

I think the idea was to also change infrastructure to infrastructureMachine in MachineDeploymentClass. Is this still the plan? (or would this be just a separate PR?)


// machineHealthCheck defines a MachineHealthCheck for this ControlPlaneClass.
// This field is supported if and only if the ControlPlane provider template
Expand Down Expand Up @@ -1171,9 +1170,9 @@ type ExternalPatchDefinition struct {
Settings map[string]string `json:"settings,omitempty"`
}

// ControlPlaneClassMachineInfrastructureTemplate defines the template for a MachineInfrastructure of a ControlPlane.
type ControlPlaneClassMachineInfrastructureTemplate struct {
// templateRef is a required reference to the template for a MachineInfrastructure of a ControlPlane.
// ControlPlaneClassInfrastructureMachineTemplate defines the template for a InfrastructureMachine of a ControlPlane.
type ControlPlaneClassInfrastructureMachineTemplate struct {
// templateRef is a required reference to the template for a InfrastructureMachine of a ControlPlane.
// +required
TemplateRef ClusterClassTemplateReference `json:"templateRef,omitempty,omitzero"`
}
Expand Down
38 changes: 19 additions & 19 deletions api/core/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 28 additions & 28 deletions api/core/v1beta2/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/clusterctl/client/cluster/objectgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ func (o *objectGraph) Discovery(ctx context.Context, namespace string) error {
_, err = o.fetchRef(ctx, discoveryBackoff, cc.Spec.ControlPlane.TemplateRef.ToObjectReference(cc.Namespace))
errs = append(errs, err)

if cc.Spec.ControlPlane.MachineInfrastructure != nil {
_, err = o.fetchRef(ctx, discoveryBackoff, cc.Spec.ControlPlane.MachineInfrastructure.TemplateRef.ToObjectReference(cc.Namespace))
if cc.Spec.ControlPlane.InfrastructureMachine != nil {
_, err = o.fetchRef(ctx, discoveryBackoff, cc.Spec.ControlPlane.InfrastructureMachine.TemplateRef.ToObjectReference(cc.Namespace))
errs = append(errs, err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type DescribeClusterOptions struct {
// AddTemplateVirtualNode instructs the discovery process to group template under a virtual node.
AddTemplateVirtualNode bool

// Echo displays MachineInfrastructure or BootstrapConfig objects if the object's ready condition is true
// Echo displays InfrastructureMachine or BootstrapConfig objects if the object's ready condition is true
// or it has the same Status, Severity and Reason of the parent's object ready condition (it is an echo)
Echo bool

Expand Down
4 changes: 2 additions & 2 deletions cmd/clusterctl/client/tree/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type DiscoverOptions struct {
// AddTemplateVirtualNode instructs the discovery process to group template under a virtual node.
AddTemplateVirtualNode bool

// Echo displays MachineInfrastructure or BootstrapConfig objects if the object's ready condition is true
// Echo displays InfrastructureMachine or BootstrapConfig objects if the object's ready condition is true
Echo bool

// Grouping groups machine objects in case the ready conditions
Expand Down Expand Up @@ -128,7 +128,7 @@ func Discovery(ctx context.Context, c client.Client, namespace, name string, opt
if visible {
if (m.Spec.InfrastructureRef != clusterv1.ContractVersionedObjectReference{}) {
if machineInfra, err := external.GetObjectFromContractVersionedRef(ctx, c, &m.Spec.InfrastructureRef, m.Namespace); err == nil {
tree.Add(m, machineInfra, ObjectMetaName("MachineInfrastructure"), NoEcho(true))
tree.Add(m, machineInfra, ObjectMetaName("InfrastructureMachine"), NoEcho(true))
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/clusterctl/client/tree/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,13 @@ func Test_Discovery(t *testing.T) {
},
// infra machines and boostrap should have meta names
clusterv1.GroupVersionInfrastructure.String() + ", Kind=GenericInfrastructureMachine, ns1/cp1": func(g *WithT, obj client.Object) {
g.Expect(GetMetaName(obj)).To(Equal("MachineInfrastructure"))
g.Expect(GetMetaName(obj)).To(Equal("InfrastructureMachine"))
},
clusterv1.GroupVersionBootstrap.String() + ", Kind=GenericBootstrapConfig, ns1/cp1": func(g *WithT, obj client.Object) {
g.Expect(GetMetaName(obj)).To(Equal("BootstrapConfig"))
},
clusterv1.GroupVersionInfrastructure.String() + ", Kind=GenericInfrastructureMachine, ns1/m1": func(g *WithT, obj client.Object) {
g.Expect(GetMetaName(obj)).To(Equal("MachineInfrastructure"))
g.Expect(GetMetaName(obj)).To(Equal("InfrastructureMachine"))
},
clusterv1.GroupVersionBootstrap.String() + ", Kind=GenericBootstrapConfig, ns1/m1": func(g *WithT, obj client.Object) {
g.Expect(GetMetaName(obj)).To(Equal("BootstrapConfig"))
Expand Down
Loading