Skip to content
Merged
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
64 changes: 60 additions & 4 deletions api/v1alpha1/hyperbytedbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,21 @@ type ChDBSpec struct {
// +optional
SessionDataPath string `json:"sessionDataPath,omitempty"`

// Ignored by hyperbytedb (libchdb is a process-global singleton). Retained
// for API stability; always written as 1 in config.toml.
// +kubebuilder:default=1
// Sets both query and write pool sizes when QueryPoolSize and WritePoolSize
// are unset. Defaults to 1 when all pool fields are unset.
// +optional
// +kubebuilder:validation:Minimum=1
PoolSize int32 `json:"poolSize,omitempty"`

// chDB connections reserved for queries. Isolated from ingest/flush.
// +optional
// +kubebuilder:validation:Minimum=1
QueryPoolSize int32 `json:"queryPoolSize,omitempty"`

// chDB connections reserved for ingest and flush (Arrow WAL build, INSERTs).
// +optional
// +kubebuilder:validation:Minimum=1
WritePoolSize int32 `json:"writePoolSize,omitempty"`
}

type AuthSpec struct {
Expand Down Expand Up @@ -264,7 +275,7 @@ type ClusterTuningSpec struct {
// +kubebuilder:default=5
ReplicationMaxRetries int32 `json:"replicationMaxRetries,omitempty"`

// +kubebuilder:default=300
// +kubebuilder:default=1000
RaftHeartbeatIntervalMs int32 `json:"raftHeartbeatIntervalMs,omitempty"`

// +kubebuilder:default=1000
Expand Down Expand Up @@ -306,6 +317,12 @@ type ClusterTuningSpec struct {
// TLS for inter-node replication traffic.
// +optional
TLS *TLSSpec `json:"tls,omitempty"`

// Seconds to wait after excluding a backend from the proxy before
// deleting its pod. Gives in-flight requests time to drain.
// +kubebuilder:default=10
// +optional
DrainWaitSecs int32 `json:"drainWaitSecs,omitempty"`
}

// ReplicationSpec controls coordinator-side replication (how this node's
Expand Down Expand Up @@ -543,6 +560,40 @@ const (
ClusterPhaseFailed ClusterPhase = "Failed"
)

// RollingRestartPhase tracks which step of the proxy-coordinated rolling
// restart the operator is currently executing.
type RollingRestartPhase string

const (
RollingRestartExcluding RollingRestartPhase = "Excluding"
RollingRestartDraining RollingRestartPhase = "Draining"
RollingRestartWaitingReady RollingRestartPhase = "WaitingReady"
RollingRestartIncluding RollingRestartPhase = "Including"
RollingRestartCompleted RollingRestartPhase = "Completed"
)

// RollingRestartState tracks pod-by-pod proxy exclusion during rolling upgrades.
// Nil when no rolling restart is in progress.
type RollingRestartState struct {
// Ordinal of the pod currently being restarted.
CurrentOrdinal int32 `json:"currentOrdinal"`

// Total number of pod ordinals to cycle through.
TotalOrdinals int32 `json:"totalOrdinals"`

// Current phase of the restart state machine.
Phase RollingRestartPhase `json:"phase"`

// When the current phase started (used to compute drain wait).
PhaseStartedAt metav1.Time `json:"phaseStartedAt"`

// IP of the pod being excluded (set during Excluding phase).
OldPodIP string `json:"oldPodIP,omitempty"`

// True once the proxy confirms the backend is excluded.
ExcludeConfirmed bool `json:"excludeConfirmed"`
}

// MemberStatus describes the observed state of a single cluster member.
type MemberStatus struct {
// Stable identifier derived from the StatefulSet ordinal.
Expand Down Expand Up @@ -604,6 +655,11 @@ type HyperbytedbClusterStatus struct {
// +optional
ConfigHash string `json:"configHash,omitempty"`

// Tracks pod-by-pod proxy exclusion during rolling upgrades.
// Nil when no rolling restart is in progress.
// +optional
RollingRestart *RollingRestartState `json:"rollingRestart,omitempty"`

// +listType=map
// +listMapKey=type
// +optional
Expand Down
21 changes: 21 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -2977,20 +2977,39 @@ spec:
chdb:
properties:
poolSize:
default: 1
description: |-
Ignored by hyperbytedb (libchdb is a process-global singleton). Retained
for API stability; always written as 1 in config.toml.
Sets both query and write pool sizes when QueryPoolSize and WritePoolSize
are unset. Defaults to 1 when all pool fields are unset.
format: int32
minimum: 1
type: integer
queryPoolSize:
description: chDB connections reserved for queries. Isolated from
ingest/flush.
format: int32
minimum: 1
type: integer
sessionDataPath:
description: |-
chDB session directory inside the data volume. Defaults to
/var/lib/hyperbytedb/chdb when unset.
type: string
writePoolSize:
description: chDB connections reserved for ingest and flush (Arrow
WAL build, INSERTs).
format: int32
minimum: 1
type: integer
type: object
cluster:
properties:
drainWaitSecs:
default: 10
description: |-
Seconds to wait after excluding a backend from the proxy before
deleting its pod. Gives in-flight requests time to drain.
format: int32
type: integer
heartbeatIntervalSecs:
default: 2
format: int32
Expand All @@ -3004,7 +3023,7 @@ spec:
format: int32
type: integer
raftHeartbeatIntervalMs:
default: 300
default: 1000
format: int32
type: integer
raftSnapshotThreshold:
Expand Down Expand Up @@ -3977,6 +3996,41 @@ spec:
description: 'Replication convergence state: Healthy, Lagging, Diverged,
Unknown.'
type: string
rollingRestart:
description: |-
Tracks pod-by-pod proxy exclusion during rolling upgrades.
Nil when no rolling restart is in progress.
properties:
currentOrdinal:
description: Ordinal of the pod currently being restarted.
format: int32
type: integer
excludeConfirmed:
description: True once the proxy confirms the backend is excluded.
type: boolean
oldPodIP:
description: IP of the pod being excluded (set during Excluding
phase).
type: string
phase:
description: Current phase of the restart state machine.
type: string
phaseStartedAt:
description: When the current phase started (used to compute drain
wait).
format: date-time
type: string
totalOrdinals:
description: Total number of pod ordinals to cycle through.
format: int32
type: integer
required:
- currentOrdinal
- excludeConfirmed
- phase
- phaseStartedAt
- totalOrdinals
type: object
type: object
required:
- spec
Expand Down
Loading
Loading