MachineSet and ControlPlanes with longer names no longer reconcile
#7,710 opened on Dec 8, 2022
Repository metrics
- Stars
- (4,267 stars)
- PR merge metrics
- (PR metrics pending)
Description
On main, v1.3.0 and v1.2.7 MachineSets and ControlPlanes with longer names can no longer be reconciled. This is due to using the MachineSet name as the value in a label which has different validation rules than a Kubernetes object name. The most important difference being a maximum length of 63 characters for label values.
The issue was introduced as part of the adoption fix for Machines which was backported to the v1.2 release branch - https://github.com/kubernetes-sigs/cluster-api/pull/7591
This can be resolved by hashing overly-long names when applying the label. This will result in a worse UX for users that have MachineSets with long names as the label will no longer be human-readable.
As part of fixing this we can regularlize and improve the way objects in CAPI are named in order to prevent this issue from recurring and limit the situations where the hashing needs to be done.
The following would improve the situation:
- Update labelling strategy to reduce the length of MS and CP labels when overly-long. (described above) #7711
- Explicitly enforce max length of 63 characters for Cluster name. This is currently enforced implicitly as the Cluster name is used as a label value in multiple objects. #7712
- Explicitly enforce max length of 63 characters for MachineDeployment name length in MD webhook. This is currently enforced implicitly as the MD name is used as a label value in multiple objects. #7712
- Use SimpleNameGenerator for generating names for MachineSets. This will implicitly enforce a maximum MS name length of 63 characters for MSes created by the MD controller.
/kind bug