Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions apps/v1alpha1/collaset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ const (
DeletePersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Delete"
)

// HostnamePolicyType indicates how the pod's hostname is determined.
// +kubebuilder:validation:Enum=PodName
type HostnamePolicyType string

const (
// HostnamePolicyPodName sets the pod's hostname to the pod name.
// This requires namingStrategy.podNamingSuffixPolicy to be PersistentSequence,
// as the pod name must be deterministic before creation.
Comment thread
ColdsteelRail marked this conversation as resolved.
// The resulting pod name must also be a valid Kubernetes hostname label:
// a single RFC 1123 DNS label containing no dots and no more than 63 characters.
// Otherwise the Pod will be rejected by the API server when the hostname is set.
HostnamePolicyPodName HostnamePolicyType = "PodName"
)
Comment thread
ColdsteelRail marked this conversation as resolved.
Comment thread
ColdsteelRail marked this conversation as resolved.

// PodUpdateStrategyType is a string enumeration type that enumerates
// all possible ways we can update a Pod when updating application
type PodUpdateStrategyType string
Expand Down Expand Up @@ -123,6 +137,13 @@ type CollaSetSpec struct {
// +optional
NamingStrategy *NamingStrategy `json:"namingStrategy,omitempty"`

// HostnamePolicy indicates how the pod's hostname is determined.
// When unset (nil), no hostname policy is applied.
// When set to "PodName", the pod's spec.hostname will be set to the pod name.
// This requires NamingStrategy.PodNamingSuffixPolicy to be PersistentSequence.
// +optional
HostnamePolicy *HostnamePolicyType `json:"hostnamePolicy,omitempty"`

Comment thread
ColdsteelRail marked this conversation as resolved.
// Indicate the number of histories to be conserved
// If unspecified, defaults to 20
// +optional
Expand Down
5 changes: 5 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.

9 changes: 9 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,15 @@ spec:
If unspecified, defaults to 20
format: int32
type: integer
hostnamePolicy:
description: |-
HostnamePolicy indicates how the pod's hostname is determined.
When unset (nil), no hostname policy is applied.
When set to "PodName", the pod's spec.hostname will be set to the pod name.
This requires NamingStrategy.PodNamingSuffixPolicy to be PersistentSequence.
enum:
- PodName
type: string
namingStrategy:
description: NamigPolicy indicates the strategy detail that will be
used for replica naming
Expand Down
Loading