Cluster validation allows invalid worker topology names #12068
Labels
area/clusterclass
Issues or PRs related to clusterclass
kind/bug
Categorizes issue or PR as related to a bug.
priority/important-soon
Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
What steps did you take and what happened?
The worker topologies are found under
Cluster.Spec.Topology.Workers.MachineDeployments
andCluster.Spec.Topology.Workers.MachinePools
. Each of these has aName
field.The the topology controller uses the value of the
Name
field to generate a MachineDeployment or MachinePool name, respectively, so the value must be a valid Kubernetes resource name, i.e. it must conform to https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names.Today, the
Name
field validation checks only length and uniqueness.If I assign a
Name
field a value (wrk_z_cli
) with an underscore, making it invalid for a Kubernetes resource, I get no validation error. However, the topology controller returns an error when it fails to create a resource. The following controller log excerpt shows this:What did you expect to happen?
The Cluster validation should reject a worker topology name that would result in an invalid Kubernetes resource name.
Cluster API version
v1.9.4
Kubernetes version
v1.31.4
Anything else you would like to add?
No response
Label(s) to be applied
/kind bug
/area clusterclass
The text was updated successfully, but these errors were encountered: