Skip to content

✨feat: Add machineNaming support to ClusterClass and Cluster topology - #13701

Open
sats-23 wants to merge 4 commits into
kubernetes-sigs:mainfrom
sats-23:issue13540
Open

✨feat: Add machineNaming support to ClusterClass and Cluster topology#13701
sats-23 wants to merge 4 commits into
kubernetes-sigs:mainfrom
sats-23:issue13540

Conversation

@sats-23

@sats-23 sats-23 commented May 14, 2026

Copy link
Copy Markdown

What this PR does / why we need it:

Adds support for customizing Machine names within topology-managed MachineDeployments by exposing the machineNaming field from MachineDeploymentSpec in ClusterClass and Cluster topology.

Changes

API Changes

  • Add machineNaming field to v1beta1 and v1beta2 MachineDeploymentClass and MachineDeploymentTopology
  • Implement v1beta1 ↔ v1beta2 conversion logic for machineNaming fields

Controller Changes

  • Add controller logic to compute and apply machineNaming from topology/class to MachineDeployments

Validation

  • Add validateMachineNamingStrategies() to ClusterClass webhook
  • Add validateTopologyMachineNaming() to Cluster webhook
  • Validate template contains required {{ .random }} variable
  • Validate generated names are valid DNS-1123 subdomains
  • Integrate validation into existing webhook flows

Testing & Documentation

  • Add comprehensive tests for machineNaming validation and behavior
  • Add documentation for topology MachineDeployments with machineNaming

The validation ensures that machineNaming templates defined in MachineDeploymentClass (ClusterClass defaults) and MachineDeploymentTopology (Cluster overrides) will generate valid Kubernetes object names before resources are created.

Which issue(s) this PR fixes:
Fixes #13540

/area clusterclass
/area machinedeployment

This PR was curated with the help of Bob (AI IDE)

@k8s-ci-robot k8s-ci-robot added area/clusterclass Issues or PRs related to clusterclass area/machinedeployment Issues or PRs related to machinedeployments labels May 14, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chrischdi for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
k8s-ci-robot requested review from JoelSpeed and elmiko May 14, 2026 14:09
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 14, 2026
sats-23 added 3 commits May 14, 2026 19:41
Expose the machineNaming field from MachineDeploymentSpec in ClusterClass
and Cluster topology to allow topology-managed clusters to customize Machine
names within MachineDeployments.

Changes:
- Add machineNaming field to v1beta1 MachineDeploymentClass and MachineDeploymentTopology
- Add machineNaming field to v1beta2 MachineDeploymentClass and MachineDeploymentTopology
- Implement v1beta1 ↔ v1beta2 conversion logic for machineNaming fields
- Add controller logic to compute and apply machineNaming from topology/class to MachineDeployments

Signed-off-by: Sathvik <Sathvik.S@ibm.com>
topology webhooks to ensure templates are valid before resources are created.

Changes:
- Add validateMachineNamingStrategies() to ClusterClass webhook
- Add validateTopologyMachineNaming() to Cluster webhook
- Validate template contains required {{ .random }} variable
- Validate generated names are valid DNS-1123 subdomains
- Integrate validation into existing webhook flows

The validation ensures that machineNaming templates defined in
MachineDeploymentClass (ClusterClass defaults) and MachineDeploymentTopology
(Cluster overrides) will generate valid Kubernetes object names.

Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
@sats-23

sats-23 commented May 20, 2026

Copy link
Copy Markdown
Author

/cc @fabriziopandini

@sbueringer

Copy link
Copy Markdown
Member

@sats-23 Could you please clarify whether this PR or your replies were written using an AI tool?

If yes, please follow: kubernetes.dev/docs/guide/pull-requests#ai-guidance

@sats-23

sats-23 commented May 28, 2026

Copy link
Copy Markdown
Author

@sats-23 Could you please clarify whether this PR or your replies were written using an AI tool?

If yes, please follow: kubernetes.dev/docs/guide/pull-requests#ai-guidance

Hey @sbueringer, the PR was curated with the help of Bob, but I have thoroughly reviewed and tested the code myself.
I have updated the PR description as well to mention the AI IDE usage as per the guidelines

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 18, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/clusterclass Issues or PRs related to clusterclass area/machinedeployment Issues or PRs related to machinedeployments cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add machineNaming support to MachineDeploymentClass and MachineDeploymentTopology

3 participants