Open iambocai opened 2 months ago
Hi @furykerry , I can work on this issue, can you assign me?
/assign @Radeity
Hi @iambocai , I've tested this issue, actually, the limit is not pod name, but the length of label name
& label value
.
For this issue, there's already a feature gate to handle it, you can set CloneSetShortHash
to true
, and then you can use longer cs name.
Related code logic: https://github.com/openkruise/kruise/blob/89d9558dd511a96c7ed1a01ca7fdfe2eec5c3324/pkg/controller/cloneset/utils/cloneset_utils.go#L71-L79
Thus, it seems like no need to make any changes to codes. cc @furykerry
@Radeity although short cloneset hash can be helpful to break the name length limit, it is still beneficial to support generateName field which is a more common way to handle this problem
Hi @furykerry , thanks for your reply. If I understand correctly, in this feat, we should support to use CloneSet/StatefulSet's GenerateName
as the prefix of their children's pod name, and keep suffix of pod name unchanged (like availableID in CloneSet, ordinal of StatefulSet)?
yes, just replace the prefix with generateName if available
What would you like to be added:
To make CloneSet and StatefulSet support the GenerateName setting.
Why is this needed:
Currently, CloneSet rigidly uses
{workloadName}-{randomID}
when generatingpod.Name
. There is a risk here as workload names can be up to 253 bytes long, while pod names are limited to 63 bytes. Therefore, if the user-defined workload name exceeds 57 bytes, the resulting pod name will exceed the limit and become unusable. The general solution to this problem is to specifyGenerateName
, but our current implementation of CloneSet does not support this feature. This leaves users facing such issues with no option but to shorten the workload name, which compromises readability and is not a good solution from a management standpoint. Therefore, I hope that support for theGenerateName
setting can be incorporated.https://github.com/openkruise/kruise/blob/a836e90578067d0c44372bc3be116cc3d06babed/pkg/controller/cloneset/core/cloneset_core.go#L98
The requirements for StatefulSet would be similar.