kubernetes-sigs / kubernetes-sigs/cluster-api
MachineSet and ControlPlanes with longer names no longer reconcile
- Dominant language
- Go
- Stars
- 4.3k
- Forks
- 1.6k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 113
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:
1. Update labelling strategy to reduce the length of MS and CP labels when overly-long. (described above) #7711
2. 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
3. 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
4. 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
Contributor guide
Research direction
Start by reproducing reconciliation for MachineSets and ControlPlanes with names longer than 63 characters, then inspect the adoption fix from pull request #7591 and the label-application path. Confirm that the label value violates Kubernetes' 63-character limit, and verify that long names reconcile successfully after the naming and validation changes described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100