Skip to content
Open
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
3 changes: 3 additions & 0 deletions api/rediscluster/v1beta2/rediscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ type RedisClusterSpec struct {
PersistenceEnabled *bool `json:"persistenceEnabled,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
HostPort *int `json:"hostPort,omitempty"`
// +optional
// +kubebuilder:validation:Enum=OrderedReady;Parallel
PodManagementPolicy *string `json:"podManagementPolicy,omitempty"`
}

// Node-conf needs to be added only in redis cluster
Expand Down
5 changes: 5 additions & 0 deletions api/rediscluster/v1beta2/zz_generated.deepcopy.go

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

3 changes: 3 additions & 0 deletions api/redisreplication/v1beta2/redisreplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ type RedisReplicationSpec struct {
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
TopologySpreadConstrains []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
HostPort *int `json:"hostPort,omitempty"`
// +optional
// +kubebuilder:validation:Enum=OrderedReady;Parallel
PodManagementPolicy *string `json:"podManagementPolicy,omitempty"`
}

func (cr *RedisReplicationSpec) GetReplicationCounts(t string) int32 {
Expand Down
5 changes: 5 additions & 0 deletions api/redisreplication/v1beta2/zz_generated.deepcopy.go

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

3 changes: 3 additions & 0 deletions api/redissentinel/v1beta2/redissentinel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ type RedisSentinelSpec struct {
VolumeMount *common.AdditionalVolume `json:"volumeMount,omitempty"`
TopologySpreadConstrains []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
HostPort *int `json:"hostPort,omitempty"`
// +optional
// +kubebuilder:validation:Enum=OrderedReady;Parallel
PodManagementPolicy *string `json:"podManagementPolicy,omitempty"`
}

func (cr *RedisSentinelSpec) GetSentinelCounts(t string) int32 {
Expand Down
5 changes: 5 additions & 0 deletions api/redissentinel/v1beta2/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions charts/redis-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ helm delete <my-release> --namespace <namespace>
| initContainer.imagePullPolicy | string | `"IfNotPresent"` | |
| initContainer.resources | object | `{}` | |
| labels | object | `{}` | |
| podManagementPolicy | string | `"OrderedReady"` | |
| podSecurityContext.fsGroup | int | `1000` | |
| podSecurityContext.runAsUser | int | `1000` | |
| priorityClassName | string | `""` | |
Expand Down
3 changes: 3 additions & 0 deletions charts/redis-cluster/templates/redis-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ spec:
{{- if and .Values.serviceAccountName (ne .Values.serviceAccountName "") }}
serviceAccountName: "{{ .Values.serviceAccountName }}"
{{- end }}
{{- if and .Values.podManagementPolicy (ne .Values.podManagementPolicy "") }}
podManagementPolicy: "{{ .Values.podManagementPolicy }}"
{{- end }}
2 changes: 2 additions & 0 deletions charts/redis-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,5 @@ env: []
# value: "value1"

serviceAccountName: ""

podManagementPolicy: OrderedReady
15 changes: 15 additions & 0 deletions charts/redis-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6303,6 +6303,11 @@ spec:
type: object
persistenceEnabled:
type: boolean
podManagementPolicy:
enum:
- OrderedReady
- Parallel
type: string
podSecurityContext:
description: |-
PodSecurityContext holds pod-level security attributes and common container settings.
Expand Down Expand Up @@ -15188,6 +15193,11 @@ spec:
format: int32
type: integer
type: object
podManagementPolicy:
enum:
- OrderedReady
- Parallel
type: string
podSecurityContext:
description: |-
PodSecurityContext holds pod-level security attributes and common container settings.
Expand Down Expand Up @@ -20707,6 +20717,11 @@ spec:
format: int32
type: integer
type: object
podManagementPolicy:
enum:
- OrderedReady
- Parallel
type: string
podSecurityContext:
description: |-
PodSecurityContext holds pod-level security attributes and common container settings.
Expand Down
1 change: 1 addition & 0 deletions charts/redis-replication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ helm delete <my-release> --namespace <namespace>
| pdb.enabled | bool | `false` | |
| pdb.maxUnavailable | string | `nil` | |
| pdb.minAvailable | int | `1` | |
| podManagementPolicy | string | `"OrderedReady"` | |
| podSecurityContext.fsGroup | int | `1000` | |
| podSecurityContext.runAsUser | int | `1000` | |
| priorityClassName | string | `""` | |
Expand Down
4 changes: 3 additions & 1 deletion charts/redis-replication/templates/redis-replication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@ spec:
minAvailable: {{ .Values.pdb.minAvailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- end }}

{{- if and .Values.podManagementPolicy (ne .Values.podManagementPolicy "") }}
podManagementPolicy: "{{ .Values.podManagementPolicy }}"
{{- end }}
2 changes: 2 additions & 0 deletions charts/redis-replication/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,5 @@ pdb:
enabled: false
minAvailable: 1
maxUnavailable: null

podManagementPolicy: OrderedReady
1 change: 1 addition & 0 deletions charts/redis-sentinel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ helm delete <my-release> --namespace <namespace>
| pdb.enabled | bool | `false` | |
| pdb.maxUnavailable | string | `nil` | |
| pdb.minAvailable | int | `1` | |
| podManagementPolicy | string | `"OrderedReady"` | |
| podSecurityContext.fsGroup | int | `1000` | |
| podSecurityContext.runAsUser | int | `1000` | |
| priorityClassName | string | `""` | |
Expand Down
3 changes: 3 additions & 0 deletions charts/redis-sentinel/templates/redis-sentinel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ spec:
{{- if .Values.env }}
env: {{ toYaml .Values.env | nindent 4 }}
{{- end }}
{{- if and .Values.podManagementPolicy (ne .Values.podManagementPolicy "") }}
podManagementPolicy: "{{ .Values.podManagementPolicy }}"
{{- end }}
2 changes: 2 additions & 0 deletions charts/redis-sentinel/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,5 @@ readinessProbe:
env: []
# - name: VAR_NAME
# value: "value1"

podManagementPolicy: OrderedReady
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,11 @@ spec:
type: object
persistenceEnabled:
type: boolean
podManagementPolicy:
enum:
- OrderedReady
- Parallel
type: string
podSecurityContext:
description: |-
PodSecurityContext holds pod-level security attributes and common container settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1935,6 +1935,11 @@ spec:
format: int32
type: integer
type: object
podManagementPolicy:
enum:
- OrderedReady
- Parallel
type: string
podSecurityContext:
description: |-
PodSecurityContext holds pod-level security attributes and common container settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,11 @@ spec:
format: int32
type: integer
type: object
podManagementPolicy:
enum:
- OrderedReady
- Parallel
type: string
podSecurityContext:
description: |-
PodSecurityContext holds pod-level security attributes and common container settings.
Expand Down
3 changes: 3 additions & 0 deletions docs/content/en/docs/CRD Reference/API Reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ _Appears in:_
| `persistenceEnabled` _boolean_ | | | |
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
| `hostPort` _integer_ | | | |
| `podManagementPolicy` _string_ | | | Enum: [OrderedReady Parallel] <br /> |



Expand Down Expand Up @@ -409,6 +410,7 @@ _Appears in:_
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
| `topologySpreadConstraints` _[TopologySpreadConstraint](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#topologyspreadconstraint-v1-core) array_ | | | |
| `hostPort` _integer_ | | | |
| `podManagementPolicy` _string_ | | | Enum: [OrderedReady Parallel] <br /> |


#### RedisSentinel
Expand Down Expand Up @@ -490,6 +492,7 @@ _Appears in:_
| `volumeMount` _[AdditionalVolume](#additionalvolume)_ | | | |
| `topologySpreadConstraints` _[TopologySpreadConstraint](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#topologyspreadconstraint-v1-core) array_ | | | |
| `hostPort` _integer_ | | | |
| `podManagementPolicy` _string_ | | | Enum: [OrderedReady Parallel] <br /> |


#### RedisSpec
Expand Down
5 changes: 5 additions & 0 deletions internal/k8sutils/redis-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func generateRedisClusterParams(ctx context.Context, cr *rcvb2.RedisCluster, rep
HostNetwork: cr.Spec.HostNetwork,
MinReadySeconds: minreadyseconds,
}

if cr.Spec.PodManagementPolicy != nil {
res.PodManagementPolicy = cr.Spec.PodManagementPolicy
}

if cr.Spec.RedisExporter != nil {
res.EnableMetrics = cr.Spec.RedisExporter.Enabled
}
Expand Down
5 changes: 5 additions & 0 deletions internal/k8sutils/redis-replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ func generateRedisReplicationParams(cr *rrvb2.RedisReplication) statefulSetParam
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
MinReadySeconds: minreadyseconds,
}

if cr.Spec.PodManagementPolicy != nil {
res.PodManagementPolicy = cr.Spec.PodManagementPolicy
}

if cr.Spec.KubernetesConfig.ImagePullSecrets != nil {
res.ImagePullSecrets = cr.Spec.KubernetesConfig.ImagePullSecrets
}
Expand Down
4 changes: 4 additions & 0 deletions internal/k8sutils/redis-sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ func generateRedisSentinelParams(ctx context.Context, cr *rsvb2.RedisSentinel, r
MinReadySeconds: minreadyseconds,
}

if cr.Spec.PodManagementPolicy != nil {
res.PodManagementPolicy = cr.Spec.PodManagementPolicy
}

if cr.Spec.KubernetesConfig.ImagePullSecrets != nil {
res.ImagePullSecrets = cr.Spec.KubernetesConfig.ImagePullSecrets
}
Expand Down
5 changes: 5 additions & 0 deletions internal/k8sutils/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ type statefulSetParameters struct {
IgnoreAnnotations []string
HostNetwork bool
MinReadySeconds int32
PodManagementPolicy *string
}

// containerParameters will define container input params
Expand Down Expand Up @@ -316,6 +317,10 @@ func generateStatefulSetsDef(stsMeta metav1.ObjectMeta, params statefulSetParame

statefulset.Spec.Template.Spec.InitContainers = generateInitContainerDef(containerParams.Role, stsMeta.GetName(), initcontainerParams, params.ExternalConfig, initcontainerParams.AdditionalMountPath, containerParams, params.ClusterVersion)

if params.PodManagementPolicy != nil {
statefulset.Spec.PodManagementPolicy = appsv1.PodManagementPolicyType(*params.PodManagementPolicy)
}

if params.Tolerations != nil {
statefulset.Spec.Template.Spec.Tolerations = *params.Tolerations
}
Expand Down
Loading