From c6ecce7b08e96a9849ae6497f3f16d0aee3fa7b8 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Mon, 8 Sep 2025 19:24:18 +0800 Subject: [PATCH 01/12] collaset api: add PodNamingPolicy in scaleStrategy --- apps/v1alpha1/collaset_types.go | 16 ++++++++++++++++ .../crd/apps/apps.kusionstack.io_collasets.yaml | 3 +++ 2 files changed, 19 insertions(+) diff --git a/apps/v1alpha1/collaset_types.go b/apps/v1alpha1/collaset_types.go index c0d4e99..97dc07b 100644 --- a/apps/v1alpha1/collaset_types.go +++ b/apps/v1alpha1/collaset_types.go @@ -28,6 +28,19 @@ const ( CollaSetUpdate CollaSetConditionType = "Update" ) +// PodNamingPolicy is a string enumeration that determaines how pod name will be generated. +// A collaset pod name contains two parts to be placed in a string formation %s-%s; the prefix +// is name of collaset, and the postfix is determined by PodNamingPolicy. +type PodNamingPolicy string + +const ( + // PodNamingPolicyPersistentSequence uses persistent sequential numbers as pod name postfix. + PodNamingPolicyPersistentSequence PodNamingPolicy = "PersistentSequence" + // PodNamingPolicyDefault uses random strings which are provided by Kubernetes as pod name postfix. + // This is defaulting value. + PodNamingPolicyDefault PodNamingPolicy = "Default" +) + // PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine // which action will be applied on volumes from the VolumeClaimTemplates when the CollaSet is // deleted or scaled down. @@ -120,6 +133,9 @@ type ScaleStrategy struct { // +optional Context string `json:"context,omitempty"` + // PodNamingPolicy indicates how a new pod name is generated. + PodNamingPolicy PodNamingPolicy `json:"podNamingPolicy,omitempty"` + // PodToExclude indicates the pods which will be orphaned by CollaSet. // +optional PodToExclude []string `json:"podToExclude,omitempty"` diff --git a/config/crd/apps/apps.kusionstack.io_collasets.yaml b/config/crd/apps/apps.kusionstack.io_collasets.yaml index 274a049..67ccfa6 100644 --- a/config/crd/apps/apps.kusionstack.io_collasets.yaml +++ b/config/crd/apps/apps.kusionstack.io_collasets.yaml @@ -134,6 +134,9 @@ spec: the replica count to be deleted. type: string type: object + podNamingPolicy: + description: PodNamingPolicy indicates how a new pod name is generated. + type: string podToDelete: description: PodToDelete indicates the pods which will be deleted by CollaSet. From 0e624957a5a55a73675aaf6ffa14bbb7da7a8c51 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 16:11:33 +0800 Subject: [PATCH 02/12] remove unused ci --- .github/workflows/ci.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3f67f4b..c799f3f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,11 +70,4 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - fetch-depth: 0 - - name: TruffleHog OSS - uses: trufflesecurity/trufflehog@main - with: - path: ./ - base: ${{ github.event.repository.default_branch }} - head: HEAD - extra_args: --debug --json + fetch-depth: 0 \ No newline at end of file From 317733758e0385743479fb7510111c47dd121411 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 16:11:59 +0800 Subject: [PATCH 03/12] remove unused ci --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c799f3f..e4383bd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,4 +70,4 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - fetch-depth: 0 \ No newline at end of file + fetch-depth: 0 From 98394d2b2e8d705789c856e4e594800ba59e77f2 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 16:12:51 +0800 Subject: [PATCH 04/12] remove unused ci --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e4383bd..c799f3f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,4 +70,4 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 0 \ No newline at end of file From d8b5a37a4fb09c4bdbb2621cc31d21ff8bfbb725 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 16:26:31 +0800 Subject: [PATCH 05/12] refactor suffix --- apps/v1alpha1/collaset_types.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/v1alpha1/collaset_types.go b/apps/v1alpha1/collaset_types.go index 97dc07b..c5b5734 100644 --- a/apps/v1alpha1/collaset_types.go +++ b/apps/v1alpha1/collaset_types.go @@ -30,13 +30,13 @@ const ( // PodNamingPolicy is a string enumeration that determaines how pod name will be generated. // A collaset pod name contains two parts to be placed in a string formation %s-%s; the prefix -// is name of collaset, and the postfix is determined by PodNamingPolicy. +// is name of collaset, and the suffix is determined by PodNamingPolicy. type PodNamingPolicy string const ( - // PodNamingPolicyPersistentSequence uses persistent sequential numbers as pod name postfix. + // PodNamingPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. PodNamingPolicyPersistentSequence PodNamingPolicy = "PersistentSequence" - // PodNamingPolicyDefault uses random strings which are provided by Kubernetes as pod name postfix. + // PodNamingPolicyDefault uses random strings which are provided by Kubernetes as pod name suffix. // This is defaulting value. PodNamingPolicyDefault PodNamingPolicy = "Default" ) From 1ff87c43c31a2d437df06851213d96492ef6122f Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 17:01:25 +0800 Subject: [PATCH 06/12] refactor naming policy api --- apps/v1alpha1/collaset_types.go | 26 ++++++++++++------- apps/v1alpha1/zz_generated.deepcopy.go | 17 ++++++++++++ .../apps/apps.kusionstack.io_collasets.yaml | 12 ++++++--- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/apps/v1alpha1/collaset_types.go b/apps/v1alpha1/collaset_types.go index c5b5734..7a6823b 100644 --- a/apps/v1alpha1/collaset_types.go +++ b/apps/v1alpha1/collaset_types.go @@ -28,17 +28,17 @@ const ( CollaSetUpdate CollaSetConditionType = "Update" ) -// PodNamingPolicy is a string enumeration that determaines how pod name will be generated. +// ReplicaNamingPolicy is a string enumeration that determaines how pod name will be generated. // A collaset pod name contains two parts to be placed in a string formation %s-%s; the prefix -// is name of collaset, and the suffix is determined by PodNamingPolicy. -type PodNamingPolicy string +// is name of collaset, and the suffix is determined by ReplicaNamingPolicy. +type ReplicaNamingPolicy string const ( - // PodNamingPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. - PodNamingPolicyPersistentSequence PodNamingPolicy = "PersistentSequence" - // PodNamingPolicyDefault uses random strings which are provided by Kubernetes as pod name suffix. + // ReplicaNamingPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. + ReplicaNamingPolicyPersistentSequence ReplicaNamingPolicy = "PersistentSequence" + // ReplicaNamingPolicyDefault uses random strings which are provided by Kubernetes as pod name suffix. // This is defaulting value. - PodNamingPolicyDefault PodNamingPolicy = "Default" + ReplicaNamingPolicyDefault ReplicaNamingPolicy = "Default" ) // PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine @@ -120,6 +120,10 @@ type CollaSetSpec struct { // +optional ScaleStrategy ScaleStrategy `json:"scaleStrategy,omitempty"` + // NamigPolicy indicates the strategy detail that will be used for replica naming + // +optional + NamingPolicy NamingPolicy `json:"namimgPolicy,omitempty"` + // Indicate the number of histories to be conserved // If unspecified, defaults to 20 // +optional @@ -133,9 +137,6 @@ type ScaleStrategy struct { // +optional Context string `json:"context,omitempty"` - // PodNamingPolicy indicates how a new pod name is generated. - PodNamingPolicy PodNamingPolicy `json:"podNamingPolicy,omitempty"` - // PodToExclude indicates the pods which will be orphaned by CollaSet. // +optional PodToExclude []string `json:"podToExclude,omitempty"` @@ -160,6 +161,11 @@ type ScaleStrategy struct { OperationDelaySeconds *int32 `json:"operationDelaySeconds,omitempty"` } +type NamingPolicy struct { + // ReplicaNamingPolicy indicates how a new pod name is generated. + ReplicaNamingPolicy ReplicaNamingPolicy `json:"replicaNamingPolicy,omitempty"` +} + type PersistentVolumeClaimRetentionPolicy struct { // WhenDeleted specifies what happens to PVCs created from CollaSet // VolumeClaimTemplates when the CollaSet is deleted. The default policy diff --git a/apps/v1alpha1/zz_generated.deepcopy.go b/apps/v1alpha1/zz_generated.deepcopy.go index 46e2795..0d1ae9e 100644 --- a/apps/v1alpha1/zz_generated.deepcopy.go +++ b/apps/v1alpha1/zz_generated.deepcopy.go @@ -244,6 +244,7 @@ func (in *CollaSetSpec) DeepCopyInto(out *CollaSetSpec) { } in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy) in.ScaleStrategy.DeepCopyInto(&out.ScaleStrategy) + out.NamingPolicy = in.NamingPolicy return } @@ -388,6 +389,22 @@ func (in *LabelCheckRule) DeepCopy() *LabelCheckRule { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamingPolicy) DeepCopyInto(out *NamingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamingPolicy. +func (in *NamingPolicy) DeepCopy() *NamingPolicy { + if in == nil { + return nil + } + out := new(NamingPolicy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OperationJob) DeepCopyInto(out *OperationJob) { *out = *in diff --git a/config/crd/apps/apps.kusionstack.io_collasets.yaml b/config/crd/apps/apps.kusionstack.io_collasets.yaml index 67ccfa6..bf19797 100644 --- a/config/crd/apps/apps.kusionstack.io_collasets.yaml +++ b/config/crd/apps/apps.kusionstack.io_collasets.yaml @@ -83,6 +83,15 @@ spec: If unspecified, defaults to 20 format: int32 type: integer + namimgPolicy: + description: NamigPolicy indicates the strategy detail that will be + used for replica naming + properties: + replicaNamingPolicy: + description: ReplicaNamingPolicy indicates how a new pod name + is generated. + type: string + type: object paused: description: |- Indicates that the scaling and updating is paused and will not be processed by the @@ -134,9 +143,6 @@ spec: the replica count to be deleted. type: string type: object - podNamingPolicy: - description: PodNamingPolicy indicates how a new pod name is generated. - type: string podToDelete: description: PodToDelete indicates the pods which will be deleted by CollaSet. From f7808db996781e8625a59a5965994e1b1d47ad69 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 17:12:48 +0800 Subject: [PATCH 07/12] refactor naming policy api --- apps/v1alpha1/collaset_types.go | 2 +- apps/v1alpha1/zz_generated.deepcopy.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/v1alpha1/collaset_types.go b/apps/v1alpha1/collaset_types.go index 7a6823b..4549db5 100644 --- a/apps/v1alpha1/collaset_types.go +++ b/apps/v1alpha1/collaset_types.go @@ -122,7 +122,7 @@ type CollaSetSpec struct { // NamigPolicy indicates the strategy detail that will be used for replica naming // +optional - NamingPolicy NamingPolicy `json:"namimgPolicy,omitempty"` + NamingPolicy *NamingPolicy `json:"namimgPolicy,omitempty"` // Indicate the number of histories to be conserved // If unspecified, defaults to 20 diff --git a/apps/v1alpha1/zz_generated.deepcopy.go b/apps/v1alpha1/zz_generated.deepcopy.go index 0d1ae9e..7c5877d 100644 --- a/apps/v1alpha1/zz_generated.deepcopy.go +++ b/apps/v1alpha1/zz_generated.deepcopy.go @@ -244,7 +244,11 @@ func (in *CollaSetSpec) DeepCopyInto(out *CollaSetSpec) { } in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy) in.ScaleStrategy.DeepCopyInto(&out.ScaleStrategy) - out.NamingPolicy = in.NamingPolicy + if in.NamingPolicy != nil { + in, out := &in.NamingPolicy, &out.NamingPolicy + *out = new(NamingPolicy) + **out = **in + } return } From 4052f6bf83bdb57cccd841bf3752d4d97de22861 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 17:15:32 +0800 Subject: [PATCH 08/12] refactor naming policy api --- apps/v1alpha1/collaset_types.go | 22 +++++++++---------- apps/v1alpha1/zz_generated.deepcopy.go | 14 ++++++------ .../apps/apps.kusionstack.io_collasets.yaml | 7 +++--- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/apps/v1alpha1/collaset_types.go b/apps/v1alpha1/collaset_types.go index 4549db5..e60d2c4 100644 --- a/apps/v1alpha1/collaset_types.go +++ b/apps/v1alpha1/collaset_types.go @@ -28,17 +28,17 @@ const ( CollaSetUpdate CollaSetConditionType = "Update" ) -// ReplicaNamingPolicy is a string enumeration that determaines how pod name will be generated. +// PodNamingPolicy is a string enumeration that determaines how pod name will be generated. // A collaset pod name contains two parts to be placed in a string formation %s-%s; the prefix -// is name of collaset, and the suffix is determined by ReplicaNamingPolicy. -type ReplicaNamingPolicy string +// is name of collaset, and the suffix is determined by PodNamingPolicy. +type PodNamingPolicy string const ( - // ReplicaNamingPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. - ReplicaNamingPolicyPersistentSequence ReplicaNamingPolicy = "PersistentSequence" - // ReplicaNamingPolicyDefault uses random strings which are provided by Kubernetes as pod name suffix. + // PodNamingPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. + PodNamingPolicyPersistentSequence PodNamingPolicy = "PersistentSequence" + // PodNamingPolicyDefault uses random strings which are provided by Kubernetes as pod name suffix. // This is defaulting value. - ReplicaNamingPolicyDefault ReplicaNamingPolicy = "Default" + PodNamingPolicyDefault PodNamingPolicy = "Default" ) // PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine @@ -122,7 +122,7 @@ type CollaSetSpec struct { // NamigPolicy indicates the strategy detail that will be used for replica naming // +optional - NamingPolicy *NamingPolicy `json:"namimgPolicy,omitempty"` + NamingStrategy *NamingStrategy `json:"namingStrategy,omitempty"` // Indicate the number of histories to be conserved // If unspecified, defaults to 20 @@ -161,9 +161,9 @@ type ScaleStrategy struct { OperationDelaySeconds *int32 `json:"operationDelaySeconds,omitempty"` } -type NamingPolicy struct { - // ReplicaNamingPolicy indicates how a new pod name is generated. - ReplicaNamingPolicy ReplicaNamingPolicy `json:"replicaNamingPolicy,omitempty"` +type NamingStrategy struct { + // PodNamingPolicy indicates how a new pod name is generated. + PodNamingPolicy PodNamingPolicy `json:"podNamingPolicy,omitempty"` } type PersistentVolumeClaimRetentionPolicy struct { diff --git a/apps/v1alpha1/zz_generated.deepcopy.go b/apps/v1alpha1/zz_generated.deepcopy.go index 7c5877d..a5f38db 100644 --- a/apps/v1alpha1/zz_generated.deepcopy.go +++ b/apps/v1alpha1/zz_generated.deepcopy.go @@ -244,9 +244,9 @@ func (in *CollaSetSpec) DeepCopyInto(out *CollaSetSpec) { } in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy) in.ScaleStrategy.DeepCopyInto(&out.ScaleStrategy) - if in.NamingPolicy != nil { - in, out := &in.NamingPolicy, &out.NamingPolicy - *out = new(NamingPolicy) + if in.NamingStrategy != nil { + in, out := &in.NamingStrategy, &out.NamingStrategy + *out = new(NamingStrategy) **out = **in } return @@ -394,17 +394,17 @@ func (in *LabelCheckRule) DeepCopy() *LabelCheckRule { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamingPolicy) DeepCopyInto(out *NamingPolicy) { +func (in *NamingStrategy) DeepCopyInto(out *NamingStrategy) { *out = *in return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamingPolicy. -func (in *NamingPolicy) DeepCopy() *NamingPolicy { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamingStrategy. +func (in *NamingStrategy) DeepCopy() *NamingStrategy { if in == nil { return nil } - out := new(NamingPolicy) + out := new(NamingStrategy) in.DeepCopyInto(out) return out } diff --git a/config/crd/apps/apps.kusionstack.io_collasets.yaml b/config/crd/apps/apps.kusionstack.io_collasets.yaml index bf19797..3a5a1df 100644 --- a/config/crd/apps/apps.kusionstack.io_collasets.yaml +++ b/config/crd/apps/apps.kusionstack.io_collasets.yaml @@ -83,13 +83,12 @@ spec: If unspecified, defaults to 20 format: int32 type: integer - namimgPolicy: + namingStrategy: description: NamigPolicy indicates the strategy detail that will be used for replica naming properties: - replicaNamingPolicy: - description: ReplicaNamingPolicy indicates how a new pod name - is generated. + podNamingPolicy: + description: PodNamingPolicy indicates how a new pod name is generated. type: string type: object paused: From 776152966b11629012aa09868cccbdc61d794f8f Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 17:25:44 +0800 Subject: [PATCH 09/12] refactor naming policy api --- apps/v1alpha1/collaset_types.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/v1alpha1/collaset_types.go b/apps/v1alpha1/collaset_types.go index e60d2c4..97574d2 100644 --- a/apps/v1alpha1/collaset_types.go +++ b/apps/v1alpha1/collaset_types.go @@ -36,9 +36,9 @@ type PodNamingPolicy string const ( // PodNamingPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. PodNamingPolicyPersistentSequence PodNamingPolicy = "PersistentSequence" - // PodNamingPolicyDefault uses random strings which are provided by Kubernetes as pod name suffix. - // This is defaulting value. - PodNamingPolicyDefault PodNamingPolicy = "Default" + // PodNamingPolicyDefault uses generate name as prefix and a random strings which are provided + // by Kubernetes as pod name suffix. This is defaulting value. + PodNamingPolicyGenerateName PodNamingPolicy = "GenerateName" ) // PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine From 23fd54d61011dc3a9ecb46b15d26668384112814 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 17:32:10 +0800 Subject: [PATCH 10/12] refactor naming policy api --- apps/v1alpha1/collaset_types.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/v1alpha1/collaset_types.go b/apps/v1alpha1/collaset_types.go index 97574d2..b119986 100644 --- a/apps/v1alpha1/collaset_types.go +++ b/apps/v1alpha1/collaset_types.go @@ -36,8 +36,9 @@ type PodNamingPolicy string const ( // PodNamingPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. PodNamingPolicyPersistentSequence PodNamingPolicy = "PersistentSequence" - // PodNamingPolicyDefault uses generate name as prefix and a random strings which are provided - // by Kubernetes as pod name suffix. This is defaulting value. + // PodNamingPolicyGenerateName uses collaset name as pod generateName, which is the prefix + // of pod name. Kubernetes then adds a random unique string as suffix after the generateName. + // This is defaulting policy. PodNamingPolicyGenerateName PodNamingPolicy = "GenerateName" ) From 272f39292152bbddb6b78b1ea624db9dc62fa19e Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 17:46:39 +0800 Subject: [PATCH 11/12] refactor naming policy api --- apps/v1alpha1/collaset_types.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/v1alpha1/collaset_types.go b/apps/v1alpha1/collaset_types.go index b119986..2704674 100644 --- a/apps/v1alpha1/collaset_types.go +++ b/apps/v1alpha1/collaset_types.go @@ -28,18 +28,16 @@ const ( CollaSetUpdate CollaSetConditionType = "Update" ) -// PodNamingPolicy is a string enumeration that determaines how pod name will be generated. -// A collaset pod name contains two parts to be placed in a string formation %s-%s; the prefix -// is name of collaset, and the suffix is determined by PodNamingPolicy. -type PodNamingPolicy string +// PodNamingSuffixPolicy indicates how a new pod name suffix part is generated. +type PodNamingSuffixPolicy string const ( - // PodNamingPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. - PodNamingPolicyPersistentSequence PodNamingPolicy = "PersistentSequence" - // PodNamingPolicyGenerateName uses collaset name as pod generateName, which is the prefix - // of pod name. Kubernetes then adds a random unique string as suffix after the generateName. + // PodNamingSuffixPolicyPersistentSequence uses persistent sequential numbers as pod name suffix. + PodNamingSuffixPolicyPersistentSequence PodNamingSuffixPolicy = "PersistentSequence" + // PodNamingSuffixPolicyRandom uses collaset name as pod generateName, which is the prefix + // of pod name. Kubernetes then adds a random string as suffix after the generateName. // This is defaulting policy. - PodNamingPolicyGenerateName PodNamingPolicy = "GenerateName" + PodNamingSuffixPolicyRandom PodNamingSuffixPolicy = "Random" ) // PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine @@ -163,8 +161,10 @@ type ScaleStrategy struct { } type NamingStrategy struct { - // PodNamingPolicy indicates how a new pod name is generated. - PodNamingPolicy PodNamingPolicy `json:"podNamingPolicy,omitempty"` + // PodNamingSuffixPolicy is a string enumeration that determaines how pod name suffix will be generated. + // A collaset pod name contains two parts to be placed in a string formation %s-%s; the prefix is collaset + // name, and the suffix is determined by PodNamingSuffixPolicy. + PodNamingSuffixPolicy PodNamingSuffixPolicy `json:"podNamingSuffixPolicy,omitempty"` } type PersistentVolumeClaimRetentionPolicy struct { From bebaeec7575eb4fc1bad197fba56023c1dba1d44 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 9 Sep 2025 17:47:04 +0800 Subject: [PATCH 12/12] refactor naming policy api --- config/crd/apps/apps.kusionstack.io_collasets.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/crd/apps/apps.kusionstack.io_collasets.yaml b/config/crd/apps/apps.kusionstack.io_collasets.yaml index 3a5a1df..a738915 100644 --- a/config/crd/apps/apps.kusionstack.io_collasets.yaml +++ b/config/crd/apps/apps.kusionstack.io_collasets.yaml @@ -87,8 +87,11 @@ spec: description: NamigPolicy indicates the strategy detail that will be used for replica naming properties: - podNamingPolicy: - description: PodNamingPolicy indicates how a new pod name is generated. + podNamingSuffixPolicy: + description: |- + PodNamingSuffixPolicy is a string enumeration that determaines how pod name suffix will be generated. + A collaset pod name contains two parts to be placed in a string formation %s-%s; the prefix is collaset + name, and the suffix is determined by PodNamingSuffixPolicy. type: string type: object paused: