@@ -28,6 +28,18 @@ const (
2828 CollaSetUpdate CollaSetConditionType = "Update"
2929)
3030
31+ // PodNamingSuffixPolicy indicates how a new pod name suffix part is generated.
32+ type PodNamingSuffixPolicy string
33+
34+ const (
35+ // PodNamingSuffixPolicyPersistentSequence uses persistent sequential numbers as pod name suffix.
36+ PodNamingSuffixPolicyPersistentSequence PodNamingSuffixPolicy = "PersistentSequence"
37+ // PodNamingSuffixPolicyRandom uses collaset name as pod generateName, which is the prefix
38+ // of pod name. Kubernetes then adds a random string as suffix after the generateName.
39+ // This is defaulting policy.
40+ PodNamingSuffixPolicyRandom PodNamingSuffixPolicy = "Random"
41+ )
42+
3143// PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine
3244// which action will be applied on volumes from the VolumeClaimTemplates when the CollaSet is
3345// deleted or scaled down.
@@ -107,6 +119,10 @@ type CollaSetSpec struct {
107119 // +optional
108120 ScaleStrategy ScaleStrategy `json:"scaleStrategy,omitempty"`
109121
122+ // NamigPolicy indicates the strategy detail that will be used for replica naming
123+ // +optional
124+ NamingStrategy * NamingStrategy `json:"namingStrategy,omitempty"`
125+
110126 // Indicate the number of histories to be conserved
111127 // If unspecified, defaults to 20
112128 // +optional
@@ -144,6 +160,13 @@ type ScaleStrategy struct {
144160 OperationDelaySeconds * int32 `json:"operationDelaySeconds,omitempty"`
145161}
146162
163+ type NamingStrategy struct {
164+ // PodNamingSuffixPolicy is a string enumeration that determaines how pod name suffix will be generated.
165+ // A collaset pod name contains two parts to be placed in a string formation %s-%s; the prefix is collaset
166+ // name, and the suffix is determined by PodNamingSuffixPolicy.
167+ PodNamingSuffixPolicy PodNamingSuffixPolicy `json:"podNamingSuffixPolicy,omitempty"`
168+ }
169+
147170type PersistentVolumeClaimRetentionPolicy struct {
148171 // WhenDeleted specifies what happens to PVCs created from CollaSet
149172 // VolumeClaimTemplates when the CollaSet is deleted. The default policy
0 commit comments