Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support redis-cluster topologySpreadConstraints(# 868) #1177

Merged
merged 4 commits into from
Dec 21, 2024
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
34 changes: 18 additions & 16 deletions api/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,29 @@ type Sidecar struct {
// RedisLeader interface will have the redis leader configuration
// +k8s:deepcopy-gen=true
type RedisLeader struct {
Replicas *int32 `json:"replicas,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Replicas *int32 `json:"replicas,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
}

// RedisFollower interface will have the redis follower configuration
// +k8s:deepcopy-gen=true
type RedisFollower struct {
Replicas *int32 `json:"replicas,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Replicas *int32 `json:"replicas,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
}

// RedisPodDisruptionBudget configure a PodDisruptionBudget on the resource (leader/follower)
Expand Down
12 changes: 12 additions & 0 deletions api/v1beta1/rediscluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
if src.Spec.RedisLeader.NodeSelector != nil {
dst.Spec.RedisLeader.NodeSelector = src.Spec.RedisLeader.NodeSelector
}
if src.Spec.RedisLeader.TopologySpreadConstraints != nil {
dst.Spec.RedisLeader.TopologySpreadConstraints = src.Spec.RedisLeader.TopologySpreadConstraints
}

Check warning on line 53 in api/v1beta1/rediscluster_conversion.go

View check run for this annotation

Codecov / codecov/patch

api/v1beta1/rediscluster_conversion.go#L51-L53

Added lines #L51 - L53 were not covered by tests

// RedisFollower
dst.Spec.RedisFollower = redisv1beta2.RedisFollower{}
Expand Down Expand Up @@ -75,6 +78,9 @@
if src.Spec.RedisFollower.NodeSelector != nil {
dst.Spec.RedisFollower.NodeSelector = src.Spec.RedisFollower.NodeSelector
}
if src.Spec.RedisFollower.TopologySpreadConstraints != nil {
dst.Spec.RedisFollower.TopologySpreadConstraints = src.Spec.RedisFollower.TopologySpreadConstraints
}

Check warning on line 83 in api/v1beta1/rediscluster_conversion.go

View check run for this annotation

Codecov / codecov/patch

api/v1beta1/rediscluster_conversion.go#L81-L83

Added lines #L81 - L83 were not covered by tests
// RedisExporter
if src.Spec.RedisExporter != nil {
dst.Spec.RedisExporter = &redisv1beta2.RedisExporter{}
Expand Down Expand Up @@ -168,6 +174,9 @@
if src.Spec.RedisLeader.NodeSelector != nil {
dst.Spec.RedisLeader.NodeSelector = src.Spec.RedisLeader.NodeSelector
}
if src.Spec.RedisLeader.TopologySpreadConstraints != nil {
dst.Spec.RedisLeader.TopologySpreadConstraints = src.Spec.RedisLeader.TopologySpreadConstraints
}

Check warning on line 179 in api/v1beta1/rediscluster_conversion.go

View check run for this annotation

Codecov / codecov/patch

api/v1beta1/rediscluster_conversion.go#L177-L179

Added lines #L177 - L179 were not covered by tests

// RedisFollower
dst.Spec.RedisFollower = RedisFollower{}
Expand Down Expand Up @@ -195,6 +204,9 @@
if src.Spec.RedisFollower.NodeSelector != nil {
dst.Spec.RedisFollower.NodeSelector = src.Spec.RedisFollower.NodeSelector
}
if src.Spec.RedisFollower.TopologySpreadConstraints != nil {
dst.Spec.RedisFollower.TopologySpreadConstraints = src.Spec.RedisFollower.TopologySpreadConstraints
}

Check warning on line 209 in api/v1beta1/rediscluster_conversion.go

View check run for this annotation

Codecov / codecov/patch

api/v1beta1/rediscluster_conversion.go#L207-L209

Added lines #L207 - L209 were not covered by tests
// RedisExporter
if src.Spec.RedisExporter != nil {
dst.Spec.RedisExporter = &RedisExporter{}
Expand Down
14 changes: 14 additions & 0 deletions api/zz_generated.deepcopy.go

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

Loading
Loading