kubernetes-sigs/cluster-api

MachineSet and ControlPlanes with longer names no longer reconcile

Aperta

#7710 aperta il 8 dic 2022

 (12 commenti) (0 reazioni) (0 assegnatari)Go (1532 fork)auto 404
help wantedkind/bugpriority/important-longtermtriage/accepted

Metriche repository

Star
 (4267 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor