Skip to content

Commit a9f97cb

Browse files
committed
expose podManagementPolicy
Signed-off-by: Jordan Rodgers <jrodgers@mux.com>
1 parent 6de507e commit a9f97cb

11 files changed

+45
-5
lines changed

api/common_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type KubernetesConfig struct {
1717
Service *ServiceConfig `json:"service,omitempty"`
1818
IgnoreAnnotations []string `json:"ignoreAnnotations,omitempty"`
1919
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
20+
PodManagementPolicy appsv1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`
2021
}
2122

2223
// ServiceConfig define the type of service to be created and its annotations

config/crd/bases/redis.redis.opstreelabs.in_redis.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,10 @@ spec:
11101110
minReadySeconds:
11111111
format: int32
11121112
type: integer
1113+
podManagementPolicy:
1114+
description: PodManagementPolicyType defines the policy for creating
1115+
pods under a stateful set.
1116+
type: string
11131117
redisSecret:
11141118
description: ExistingPasswordSecret is the struct to access the
11151119
existing secret
@@ -6139,6 +6143,10 @@ spec:
61396143
minReadySeconds:
61406144
format: int32
61416145
type: integer
6146+
podManagementPolicy:
6147+
description: PodManagementPolicyType defines the policy for creating
6148+
pods under a stateful set.
6149+
type: string
61426150
redisSecret:
61436151
description: ExistingPasswordSecret is the struct to access the
61446152
existing secret

config/crd/bases/redis.redis.opstreelabs.in_redisclusters.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ spec:
162162
minReadySeconds:
163163
format: int32
164164
type: integer
165+
podManagementPolicy:
166+
description: PodManagementPolicyType defines the policy for creating
167+
pods under a stateful set.
168+
type: string
165169
redisSecret:
166170
description: ExistingPasswordSecret is the struct to access the
167171
existing secret
@@ -6755,6 +6759,10 @@ spec:
67556759
minReadySeconds:
67566760
format: int32
67576761
type: integer
6762+
podManagementPolicy:
6763+
description: PodManagementPolicyType defines the policy for creating
6764+
pods under a stateful set.
6765+
type: string
67586766
redisSecret:
67596767
description: ExistingPasswordSecret is the struct to access the
67606768
existing secret

config/crd/bases/redis.redis.opstreelabs.in_redisreplications.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,10 @@ spec:
11121112
minReadySeconds:
11131113
format: int32
11141114
type: integer
1115+
podManagementPolicy:
1116+
description: PodManagementPolicyType defines the policy for creating
1117+
pods under a stateful set.
1118+
type: string
11151119
redisSecret:
11161120
description: ExistingPasswordSecret is the struct to access the
11171121
existing secret
@@ -6147,6 +6151,10 @@ spec:
61476151
minReadySeconds:
61486152
format: int32
61496153
type: integer
6154+
podManagementPolicy:
6155+
description: PodManagementPolicyType defines the policy for creating
6156+
pods under a stateful set.
6157+
type: string
61506158
redisSecret:
61516159
description: ExistingPasswordSecret is the struct to access the
61526160
existing secret

config/crd/bases/redis.redis.opstreelabs.in_redissentinels.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,10 @@ spec:
11131113
minReadySeconds:
11141114
format: int32
11151115
type: integer
1116+
podManagementPolicy:
1117+
description: PodManagementPolicyType defines the policy for creating
1118+
pods under a stateful set.
1119+
type: string
11161120
redisSecret:
11171121
description: ExistingPasswordSecret is the struct to access the
11181122
existing secret
@@ -3601,6 +3605,10 @@ spec:
36013605
minReadySeconds:
36023606
format: int32
36033607
type: integer
3608+
podManagementPolicy:
3609+
description: PodManagementPolicyType defines the policy for creating
3610+
pods under a stateful set.
3611+
type: string
36043612
redisSecret:
36053613
description: ExistingPasswordSecret is the struct to access the
36063614
existing secret

docs/content/en/docs/CRD Reference/Redis API/_index.md

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ _Appears in:_
5656
| `redisSecret` _[ExistingPasswordSecret](#existingpasswordsecret)_ | |
5757
| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#localobjectreference-v1-core)_ | |
5858
| `updateStrategy` _[StatefulSetUpdateStrategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetupdatestrategy-v1-apps)_ | |
59+
| `podManagementPolicy` _[PodManagementPolicyType](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies)_ | |
5960

6061
#### VolumeMount
6162

k8sutils/redis-cluster.go

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func generateRedisClusterParams(cr *redisv1beta2.RedisCluster, replicas int32, e
5252
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
5353
HostNetwork: cr.Spec.HostNetwork,
5454
MinReadySeconds: minreadyseconds,
55+
PodManagementPolicy: cr.Spec.KubernetesConfig.PodManagementPolicy,
5556
}
5657
if cr.Spec.RedisExporter != nil {
5758
res.EnableMetrics = cr.Spec.RedisExporter.Enabled

k8sutils/redis-replication.go

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func generateRedisReplicationParams(cr *redisv1beta2.RedisReplication) statefulS
9999
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
100100
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
101101
MinReadySeconds: minreadyseconds,
102+
PodManagementPolicy: cr.Spec.KubernetesConfig.PodManagementPolicy,
102103
}
103104
if cr.Spec.KubernetesConfig.ImagePullSecrets != nil {
104105
res.ImagePullSecrets = cr.Spec.KubernetesConfig.ImagePullSecrets

k8sutils/redis-sentinel.go

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ func generateRedisSentinelParams(cr *redisv1beta2.RedisSentinel, replicas int32,
104104
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
105105
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
106106
MinReadySeconds: minreadyseconds,
107+
PodManagementPolicy: cr.Spec.KubernetesConfig.PodManagementPolicy,
107108
}
108109

109110
if cr.Spec.KubernetesConfig.ImagePullSecrets != nil {

k8sutils/redis-standalone.go

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func generateRedisStandaloneParams(cr *redisv1beta2.Redis) statefulSetParameters
9494
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
9595
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
9696
MinReadySeconds: minreadyseconds,
97+
PodManagementPolicy: cr.Spec.KubernetesConfig.PodManagementPolicy,
9798
}
9899
if cr.Spec.KubernetesConfig.ImagePullSecrets != nil {
99100
res.ImagePullSecrets = cr.Spec.KubernetesConfig.ImagePullSecrets

k8sutils/statefulset.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ type statefulSetParameters struct {
118118
IgnoreAnnotations []string
119119
HostNetwork bool
120120
MinReadySeconds int32
121+
PodManagementPolicy appsv1.PodManagementPolicyType
121122
}
122123

123124
// containerParameters will define container input params
@@ -290,11 +291,12 @@ func generateStatefulSetsDef(stsMeta metav1.ObjectMeta, params statefulSetParame
290291
TypeMeta: generateMetaInformation("StatefulSet", "apps/v1"),
291292
ObjectMeta: stsMeta,
292293
Spec: appsv1.StatefulSetSpec{
293-
Selector: LabelSelectors(stsMeta.GetLabels()),
294-
ServiceName: fmt.Sprintf("%s-headless", stsMeta.Name),
295-
Replicas: params.Replicas,
296-
UpdateStrategy: params.UpdateStrategy,
297-
MinReadySeconds: params.MinReadySeconds,
294+
Selector: LabelSelectors(stsMeta.GetLabels()),
295+
ServiceName: fmt.Sprintf("%s-headless", stsMeta.Name),
296+
Replicas: params.Replicas,
297+
UpdateStrategy: params.UpdateStrategy,
298+
MinReadySeconds: params.MinReadySeconds,
299+
PodManagementPolicy: params.PodManagementPolicy,
298300
Template: corev1.PodTemplateSpec{
299301
ObjectMeta: metav1.ObjectMeta{
300302
Labels: stsMeta.GetLabels(),

0 commit comments

Comments
 (0)