Skip to content

Commit

Permalink
Add StatefulSet UpdateStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
koct9i committed Jan 21, 2025
1 parent 5412996 commit 3d4c04d
Show file tree
Hide file tree
Showing 14 changed files with 1,272 additions and 108 deletions.
38 changes: 25 additions & 13 deletions api/v1/ytsaurus_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -245,21 +246,35 @@ type HealthcheckProbeParams struct {
}

type InstanceSpec struct {
// Desired number of instances.
InstanceCount int32 `json:"instanceCount,omitempty"`

// Acceptable number of instances.
MinReadyInstanceCount *int `json:"minReadyInstanceCount,omitempty"`

// StatefulSet update strategy.
//+optional
UpdateStrategy *appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`

// Parameters for periodic probe of instance readiness.
//+optional
ReadinessProbeParams *HealthcheckProbeParams `json:"readinessProbeParams,omitempty"`

// Optional duration in seconds the pod needs to terminate gracefully. Defaults to 30 seconds.
//+optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`

// Overrides coreImage for component.
//+optional
Image *string `json:"image,omitempty"`
// Specifies wrapper for component container command.
//+optional
EntrypointWrapper []string `json:"entrypointWrapper,omitempty"`
Volumes []corev1.Volume `json:"volumes,omitempty"`
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
//+optional
ReadinessProbeParams *HealthcheckProbeParams `json:"readinessProbeParams,omitempty"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
InstanceCount int32 `json:"instanceCount,omitempty"`
MinReadyInstanceCount *int `json:"minReadyInstanceCount,omitempty"`
Locations []LocationSpec `json:"locations,omitempty"`
VolumeClaimTemplates []EmbeddedPersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`
EntrypointWrapper []string `json:"entrypointWrapper,omitempty"`
Volumes []corev1.Volume `json:"volumes,omitempty"`
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
Locations []LocationSpec `json:"locations,omitempty"`
VolumeClaimTemplates []EmbeddedPersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`
//+optional
RuntimeClassName *string `json:"runtimeClassName,omitempty"`
// Deprecated: use Affinity.PodAntiAffinity instead.
Expand All @@ -279,9 +294,6 @@ type InstanceSpec struct {
// SetHostnameAsFQDN indicates whether to set the hostname as FQDN.
//+kubebuilder:default:=true
SetHostnameAsFQDN *bool `json:"setHostnameAsFqdn,omitempty"`
// Optional duration in seconds the pod needs to terminate gracefully.
//+optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
// Component config for native RPC bus transport.
//+optional
NativeTransport *RPCTransportSpec `json:"nativeTransport,omitempty"`
Expand Down
36 changes: 21 additions & 15 deletions api/v1/zz_generated.deepcopy.go

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

28 changes: 28 additions & 0 deletions config/crd/bases/cluster.ytsaurus.tech_remotedatanodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ spec:
x-kubernetes-map-type: atomic
type: array
instanceCount:
description: Desired number of instances.
format: int32
type: integer
jobImage:
Expand Down Expand Up @@ -866,6 +867,7 @@ spec:
type: object
type: array
minReadyInstanceCount:
description: Acceptable number of instances.
type: integer
monitoringPort:
format: int32
Expand Down Expand Up @@ -914,6 +916,7 @@ spec:
description: Name of the node rack.
type: string
readinessProbeParams:
description: Parameters for periodic probe of instance readiness.
properties:
failureThreshold:
format: int32
Expand Down Expand Up @@ -1088,6 +1091,31 @@ spec:
type: string
type: object
type: array
updateStrategy:
description: StatefulSet update strategy.
properties:
rollingUpdate:
description: RollingUpdate is used to communicate parameters when
Type is RollingUpdateStatef
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: The maximum number of pods that can be unavailable
during the update.
x-kubernetes-int-or-string: true
partition:
description: |-
Partition indicates the ordinal at which the StatefulSet should be partitioned
f
format: int32
type: integer
type: object
type:
description: Type indicates the type of the StatefulSetUpdateStrategy.
type: string
type: object
useIpv4:
default: false
type: boolean
Expand Down
28 changes: 28 additions & 0 deletions config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ spec:
type: string
type: array
instanceCount:
description: Desired number of instances.
format: int32
type: integer
jobEnvironment:
Expand Down Expand Up @@ -1051,6 +1052,7 @@ spec:
type: object
type: array
minReadyInstanceCount:
description: Acceptable number of instances.
type: integer
monitoringPort:
format: int32
Expand Down Expand Up @@ -1102,6 +1104,7 @@ spec:
description: Name of the node rack.
type: string
readinessProbeParams:
description: Parameters for periodic probe of instance readiness.
properties:
failureThreshold:
format: int32
Expand Down Expand Up @@ -1281,6 +1284,31 @@ spec:
type: string
type: object
type: array
updateStrategy:
description: StatefulSet update strategy.
properties:
rollingUpdate:
description: RollingUpdate is used to communicate parameters when
Type is RollingUpdateStatef
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: The maximum number of pods that can be unavailable
during the update.
x-kubernetes-int-or-string: true
partition:
description: |-
Partition indicates the ordinal at which the StatefulSet should be partitioned
f
format: int32
type: integer
type: object
type:
description: Type indicates the type of the StatefulSetUpdateStrategy.
type: string
type: object
useIpv4:
default: false
type: boolean
Expand Down
28 changes: 28 additions & 0 deletions config/crd/bases/cluster.ytsaurus.tech_remotetabletnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ spec:
x-kubernetes-map-type: atomic
type: array
instanceCount:
description: Desired number of instances.
format: int32
type: integer
jobImage:
Expand Down Expand Up @@ -866,6 +867,7 @@ spec:
type: object
type: array
minReadyInstanceCount:
description: Acceptable number of instances.
type: integer
monitoringPort:
format: int32
Expand Down Expand Up @@ -914,6 +916,7 @@ spec:
description: Name of the node rack.
type: string
readinessProbeParams:
description: Parameters for periodic probe of instance readiness.
properties:
failureThreshold:
format: int32
Expand Down Expand Up @@ -1088,6 +1091,31 @@ spec:
type: string
type: object
type: array
updateStrategy:
description: StatefulSet update strategy.
properties:
rollingUpdate:
description: RollingUpdate is used to communicate parameters when
Type is RollingUpdateStatef
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: The maximum number of pods that can be unavailable
during the update.
x-kubernetes-int-or-string: true
partition:
description: |-
Partition indicates the ordinal at which the StatefulSet should be partitioned
f
format: int32
type: integer
type: object
type:
description: Type indicates the type of the StatefulSetUpdateStrategy.
type: string
type: object
useIpv4:
default: false
type: boolean
Expand Down
28 changes: 28 additions & 0 deletions config/crd/bases/cluster.ytsaurus.tech_remoteytsaurus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ spec:
description: Overrides coreImage for component.
type: string
instanceCount:
description: Desired number of instances.
format: int32
type: integer
locations:
Expand Down Expand Up @@ -822,6 +823,7 @@ spec:
type: object
type: array
minReadyInstanceCount:
description: Acceptable number of instances.
type: integer
monitoringPort:
format: int32
Expand Down Expand Up @@ -863,6 +865,7 @@ spec:
type: string
type: object
readinessProbeParams:
description: Parameters for periodic probe of instance readiness.
properties:
failureThreshold:
format: int32
Expand Down Expand Up @@ -1020,6 +1023,31 @@ spec:
type: string
type: object
type: array
updateStrategy:
description: StatefulSet update strategy.
properties:
rollingUpdate:
description: RollingUpdate is used to communicate parameters when
Type is RollingUpdateStatef
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: The maximum number of pods that can be unavailable
during the update.
x-kubernetes-int-or-string: true
partition:
description: |-
Partition indicates the ordinal at which the StatefulSet should be partitioned
f
format: int32
type: integer
type: object
type:
description: Type indicates the type of the StatefulSetUpdateStrategy.
type: string
type: object
volumeClaimTemplates:
items:
description: EmbeddedPersistentVolumeClaim is an embedded version
Expand Down
Loading

0 comments on commit 3d4c04d

Please sign in to comment.