Skip to content
9 changes: 1 addition & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 23 additions & 0 deletions apps/v1alpha1/collaset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ const (
CollaSetUpdate CollaSetConditionType = "Update"
)

// PodNamingSuffixPolicy indicates how a new pod name suffix part is generated.
type PodNamingSuffixPolicy string

const (
// 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.
PodNamingSuffixPolicyRandom PodNamingSuffixPolicy = "Random"
)

// 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.
Expand Down Expand Up @@ -107,6 +119,10 @@ type CollaSetSpec struct {
// +optional
ScaleStrategy ScaleStrategy `json:"scaleStrategy,omitempty"`

// NamigPolicy indicates the strategy detail that will be used for replica naming
// +optional
NamingStrategy *NamingStrategy `json:"namingStrategy,omitempty"`

// Indicate the number of histories to be conserved
// If unspecified, defaults to 20
// +optional
Expand Down Expand Up @@ -144,6 +160,13 @@ type ScaleStrategy struct {
OperationDelaySeconds *int32 `json:"operationDelaySeconds,omitempty"`
}

type NamingStrategy struct {
// 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 {
// WhenDeleted specifies what happens to PVCs created from CollaSet
// VolumeClaimTemplates when the CollaSet is deleted. The default policy
Expand Down
21 changes: 21 additions & 0 deletions apps/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions config/crd/apps/apps.kusionstack.io_collasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ spec:
If unspecified, defaults to 20
format: int32
type: integer
namingStrategy:
description: NamigPolicy indicates the strategy detail that will be
used for replica naming
properties:
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:
description: |-
Indicates that the scaling and updating is paused and will not be processed by the
Expand Down
Loading